XEN

Installation

Assuming you have already got running debian stable machines using the 2.6.8 kernel that was shipped with Debian, we are ready to move on to installing XEN from backports.org. This process needs to be done on all three machines.

Prepare the apt sources by adding the backports repositories to the file /etc/apt/sources.list

dangermouse:~# echo "deb http://www.backports.org/debian/ sarge-backports main" >> /etc/apt/sources

Now tell apt that we don't normally want to install packages from backports.org unless we specifically ask.

dangermouse:~# cat <<! >> /etc/apt/preferences
Package: *
Pin: release a=sarge-backports
Pin-Priority: 200
!

Update the apt cache:

dangermouse:~# apt-get update

Now we want to install the xen kernel and hypervisor on every machine. This is so we get a consistent 2.6.16 kernel on every machine including the machine we will use for the disk so we can use the latest version of iSCSI Target software from IET.

dangermouse:~# aptitude -t sarge-backports install linux-image-2.6.16-1-xen-686 linux-modules-2.6.16-1-xen-686 grub xen-hypervisor-3.0-i386 xen-utils-3.0 udev

There is probably a few other packages that I have left out that will get automatically updated as well. They should all be fine.

We need to disable tls as it is not supported by XEN at this time. There may be a libc686-xen package available, and I would suggest installing that if possible instead of disabling /lib/tls.

dangermouse:~# mv /lib/tls /lib/tls.disabled

The Debian package of XEN kernel or hypervisor doesn't yet make an initrd image, so we need to make one manually.

dangermouse:~# mkinitrd -o /boot/initrd.img-2.6.16-1-xen-686 2.6.16-1-xen-686

Now prepare the boot loader. Firstly run update-grub to automatically populate /boot/grub/menu.1st, then fixup the created XEN entries, by adding two module lines and removing the initrd line.

dangermouse:~# update-grub

turn this:

kernel /boot/vmlinuz-2.6.16-1-xen-686 root=/dev/hda1 ro
initrd /boot/initrd.img-2.6.16-1-xen-686

into this in the /boot/grub/menu.1st:

kernel /boot/xen-3.0-i386.gz console=vga dom0_mem=256000
module /boot/vmlinuz-2.6.16-1-xen-686 root=/dev/hda1 ro xencons=off
module /boot/initrd.img-2.6.16-1-xen-686

Replace /dev/hda1 with whatever is your root partition. dom0_mem is the amount of memory available to the host virtual machine or domain0. xencons turns off the use of the serial port. I need the serial ports for other purposes, so this one is up to you.

Now you need to reboot and confirm that the XEN hypervisor boots and domain0 starts as well. If this fails go over the steps and make sure you didn't leave a step out. Because you still have your Debian standard kerenl installed you can always recover to that with no ill affect

XEN Configuration

Now that you have XEN installed and you are successfully booting off the XEN Hypervisor we can configure the xen daemon. The configuration file is /etc/xen/xend-config.sxp.

(xend-relocation-server yes)
(xend-relocation-hosts-allow '')
(network-script 'network-bridge netdev=eth0')
(vif-script vif-bridge)
(dom0-min-mem 196)
(dom0-cpus 0)

Now restart the xend process.

dangermouse:~# /etc/init.d/xend restart