Wednesday, November 7, 2012

A quick tutorial on building appliance using Kiwi in restricted environment

In this blog, I'll share step by step information on building a appliance using opensuse kiwi tool on a restricted environment. Here restricted environment means in the network where access to internet is not available.

Step 1: Setting up build machine
     a ) Download OpenSuse iso file (like openSUSE-12.2-DVD-x86_64.iso)
     b) Install it either on a physical machine or virtual machine. Preferably allocate around 50 GB of disk space.
     c) Configure network. You can use yast. Also change firewall configuration to open ssh port and in /etc/ssh/sshd_config make the change 'PasswordAuthentication yes' to allow ssh connection.

Step 2: Configure Zypper repo
     a) Copy the openSUSE-12.2-DVD-x86_64.iso file to the newly setup build machine (in the location /root/tools/openSUSE-12.2-DVD-x86_64.iso)
     b) mount it
         mount -o loop /root/tools/openSUSE-12.2-DVD-x86_64.iso /mnt/openSUSE-12.2
     c) Add this iso as zypper repo
         zypper ar -c -t yast2 "iso:/?iso=/root/tools/openSUSE-12.2-DVD-x86_64.iso" "openSuSE 12"

Step 3: Installing kiwi tool set
    a) You can use rpms from the mounted iso to install kiwi.
        cd /mnt/openSUSE-12.2/suse/x86_64
        zypper --no-remote install kiwi
        zypper --no-remote install kiwi-templates
        cd /mnt/openSUSE-12.2/suse/noarch/
        zypper --no-remote install kiwi-desc-oemboot-5.03.37-1.1.1.noarch.rpm kiwi-desc-netboot-5.03.37-1.1.1.noarch.rpm kiwi-desc-oemboot-5.03.37-1.1.1.noarch.rpm kiwi-pxeboot-5.03.37-1.1.1.noarch.rpm kiwi-desc-isoboot-5.03.37-1.1.1.noarch.rpm

       The above step installs all the available templates, which will be used as base image while building appliance

Step 4: Building a Jeos iso image 
     a) mkdir /tmp/myjeos
     b) kiwi --set-repo /mnt/openSUSE-12.2 --build suse-12.1-JeOS --destdir /tmp/myjeos --type iso
      If no issues, you can find your appliance at /tmp/myjeos/LimeJeOS-openSUSE-12.1.x86_64-1.12.1.iso
     c) You can deploy it on VMWare ESX server to validate it.
     d) If deployed successfully, the login details are
          Login: root
          Passwd: linux

As shown above, we used the mounted OpenSUSE-12.2 iso  as repo and the kiwi template suse-12.1-JeOS has base template and built the appliance.