How to install a openSuSE domU on a Debian dom0

From Xen
Jump to navigationJump to search

Why build a openSuSE or SLES DomU?

Many system administrators like Debian based linux servers, especially for the very smooth update and upgrade procedures. But most commercial software is published for the so-called "Enterprise" linux editions like SLES or RHEL. In case you want to evaluate some new software it would be nice to have a SuSE or RedHat system at hand. A typical scenario for a virtual machine.

Used software versions for this example

I used Debian squeeze amd64 (Kernel 2.6.32-5-xen-amd64) as dom0 and openSuSE 12.1 amd64 (Kernel 3.1.0-1.2-xen) as domU. The same procedures apply to openSuSE 11.x . There are many good recipes for installing Xen on Debian out there, so I start my example on top of a running Xen dom0.

Preparation

  • Download the openSuSE Network Installation ISO from http://software.opensuse.org and save it on your dom0.
  • Create the disk space for the domU, either as logical volume (if you have a LVM system) or plain file. Minimal size is 2GB, recommended are 4GB or more.
  • Mount the installation ISO as loopback device and copy the xen kernel and initrd out of the boot directory onto your dom0.
# mount -o loop /var/lib/xen/images/openSUSE-12.1-NET-x86_64.iso /mnt
# cp /mnt/boot/x86_64/initrd-xen /var/lib/xen/images/.
# cp /mnt/boot/x86_64/vmlinuz-xen /var/lib/xen/images/.
  • If not already done, install the xen-qemu package
  • Make sure VNC access is enabled in your Xen configuration (/etc/xen/xend-config.sxp)

Create the domU configuration

One of the little caveats is that we need a graphical interface for installing openSuSE, so in addition to the basic Xen packages we need the qemu package. Open the text editor of your choice to create the configuration file for the new domU.

# Xen configuration for installing an openSuSE domU

#
#  Kernel + memory size

kernel      = '/var/lib/xen/images/vmlinuz-xen'
ramdisk     = '/var/lib/xen/images/initrd-xen'

memory = 1200
name = 'suse'
vcpus = 2

# VNC virtual display

vfb = [ 'type=vnc' ]

#  Disk device(s).

root = '/dev/xvdb1'

disk        = [ 
                'phy:/dev/vgxen/suse-disk,xvda,w',
 # alternative: 'file:/var/lib/xen/images/suse-disk.img,xvda,w',
                'file:/var/lib/xen/images/openSUSE-12.1-NET-x86_64.iso,xvdb,r'
              ]

#  Networking

vif = [ 'bridge=eth0, mac=00:16:3E:01:01:2D' ]

#  Behaviour

on_poweroff = 'destroy'
on_reboot   = 'restart'
on_crash    = 'restart'

Installation

  • Start the new domU:
# xm create suse.cfg
  • Connect a VNC viewer to your dom0, default port will be 5900.
  • You will be presented the openSuSE install screen and then following message:

miniatur

  • Select "Back", select your languages and go further and choose Network install:

miniatur

  • you will be asked for your local network address (dhcp or manual), then the IP address of the installation source. Type in the IP address of download.opensuse.org or of another mirror near you:

miniatur

  • choose HTTP as protocal and type in the download path according to the chosen openSuSE version:

miniatur

Here we go. The system will now load the installation data from the server. In the following configuration menu you can change for example the proposed disk partitioning and the software packages to be installed. I recommend to select the xen-kernel package here. If not, you have to add it with yast right after your first logon. Notice the device the root partition (/) will be mounted. With the simple partitions scheme the default is first partition = swap, second partition = /.

After some time your openSuSE domU will be rebooted by the installer. When it is up again, you have to choose again "Back" and your languages, then select "Install" and "Boot Installed System". Most of the work is done at this point. Log in with your credentials and go to the /boot directory. Copy the xen kernel and initrd to your dom0 with scp:

# scp vmlinuz-3.1.0-1.2-xen dom0:/var/lib/xen/images/.
# scp initrd-3.1.0-1.2-xen dom0:/var/lib/xen/images/.

Perhaps you want to enable the ssh daemon, so you can connect to your domU by network later on:

# chkconfig sshd on

Final steps

Shutdown the domU. It's now time to include the real kernel in the domU configuration, start from the correct root partition and eliminate the installation ISO.

# Xen configuration of running openSuSE domU

#  Kernel + memory size

kernel      = '/var/lib/xen/images/vmlinuz-3.1.0-1.2-xen'
ramdisk     = '/var/lib/xen/images/initrd-3.1.0-1.2-xen'

memory = 1600
name = 'suse'
vcpus = 2

# VNC Display

# can be omitted, the domU is also accessible by xen console

vfb = [ 'type=vnc' ]

#  Disk device(s).

root    = '/dev/xvda2'
disk        = [
                'phy:/dev/vgxen/suse-disk,xvda,w',
              ]

#  Networking

vif = [ 'bridge=eth0, mac=00:16:3E:01:01:2D' ]

#  Behaviour

on_poweroff = 'destroy'
on_reboot   = 'restart'
on_crash    = 'restart'

Weblinks