I’ve been testing out a few virtualization systems and am sofar very pleased with Xen. Installing on Debian Etch couldn’t be easier and it worked straight out the box – I had my first virtual server running in under 15 minutes flat!
Use the following commands to install Xen on a Debian Etch machine:
apt-get install xen-linux-system-2.6.18-4-xen-686 libc6-xen bridge-utils
This will install the Xen kernel (2.6.18-5-xen-686 #1 SMP), the libc6-xen libraries which is optimized for the Xen hypervisor and the utilities for configuring the Linux ethernet bridge.
Next up is a reboot into your newly installed kernel:
reboot
Once the machine is back online you need to install the xen-tools package which allows you easily create new guest Xen domains on your Debian Etch host:
apt-get install xen-tools
Next, modify the Xen config file (/etc/xen/xend-config.sxp) and enable:
(network-script network-bridge)
You also need to modify /etc/xen-tools/xen-tools.conf to set kernel and initrd parameters as well as the disk and sizing options for your vistual servers.
You can easily find out what your kernel and initrd image is named by typing:
ls /boot/vmlinuz* /boot/initrd*
This will list the kernel and initrd names for your system. Remember, your after the xen kernel and initrd images!
/boot/initrd.img-2.6.18-5-xen-686
/boot/vmlinuz-2.6.18-5-xen-686
Continue and edit the xen-tools configuration file
vi /etc/xen-tools/xen-tools.conf
#
# Default kernel and ramdisk to use for the virtual servers
#
kernel = /boot/vmlinuz-2.6.18-5-xen-686
initrd = /boot/initrd.img-2.6.18-5-xen-686
dir = /data/vservers
debootstrap = 1
gateway = 172.16.0.1
netmask = 255.255.255.0
size = 6Gb
memory = 256Mb
swap = 256Mb
fs = ext3
dist = etch
image = sparse
Next, create the directory where your virtual servers will reside:
mkdir -p /data/vservers/domains
Now your ready to create your first virtual server! Use the following command to create it:
xen-create-image -hostname=dns -ip=172.16.0.25 -passwd
It will take a minute or two to create the virtual server after which you can fire it up by using:
xm create dns.cfg
Your virtual server should be started up and ready for you to use.. You can either ssh to the IP you created the server with or attach to it from the host using:
xm console dns
Have fun with your Xen virtual machine!