About Xen
Xen allows you to run multiple operating systems, currently Linux (2.4 and 2.6 kernels) and NetBSD, concurrently on one PC. Xen is particularly useful for systems administrators, ISPs, and ambitious/technical home users wishing to add security to their systems. Xen is notable for its very small drop in performance of the virtual machines compared to other solutions such as LinuxHints/UserModeLinux.
For more information take a look at the following web pages:
For a more detailed introduction take a look at (thanks to Andy for the URL):
Prerequisites
The following instructions assume you are running a basic install of Debian sarge.
- You will need to install the following additional packages using your preferred package installer, e.g. apt-get or aptitude.
aptitude install bridge-utils iproute libcurl-dev python2.3-dev python2.3-twisted build-essential libncurses-dev bzip2
- Note for Debian stable: You will need to create a python symlink to python2.3:
ln -s /usr/bin/python2.3 /usr/bin/python
-
Download the latest Xen stable tar ball from http://www.cl.cam.ac.uk/Research/SRG/netos/xen/downloads.html
cd /usr/src/ wget http://www.cl.cam.ac.uk/Research/SRG/netos/xen/downloads/xen-2.0.6-src.tgz
Configuring Xen
- Unpack the Xen tar ball:
tar -zxvf xen-2.0.6-src.tgz
- Build Xen:
cd zen-2.0 make world
- When this has completed you can optionally build a custom kernel. See below for details.
- Once any optional custom kernels have been compiled we install Xen:
cd /usr/src/zen-2.0 make install make install twisted # This may not be necessary - needs to checked
-
Configure your Xen domains in /etc/xen (see the sample configs).
-
Place symlinks to your config files in /etc/xen/auto for the xendomains service to auto start them. You can use loopback devices, disk partitions and LVM volumes (recommended if you plan to use Xen regularly) to house your guest Xen domains.
-
For more information on LVM2 (to use with your Xen domains) see LinuxHints/LogicalVolumeManagement.
-
To create a domain you’ll need to set up a filesystem, copy a base install of Linux, copy a XenU kernel, modules and config into /boot, and set up basic config files such /etc/hostname /etc/apt/sources.list /etc/hosts, among others.
- Make sure you unmount your new filesystem before starting your new Xen domain. otherwise you’ll probably corrupt it or possibly crash your kernel.
-
Set Xend and Xen-domains to auto start on boot (create symlinks in /etc/rc2.d)
- Add an extra entry to your boot loader. The entry for grub should look something like this:
title=Xen0 (Debian Sarge) root (hd0,0) kernel /xen.gz dom0_mem=131072 module /vmlinuz-2.6.11-xen0 root=/dev/sda2 ro console=tty0
Running Xen
You’ll need to reboot and run the Xen0 kernel to use Xen’s features. Xen domains are constrolled using the xm command. Run xm help on how to use xm. Here are few useful reminders:
- List running Xen domains (Xen virtual machines):
xm list
- Start a Xen domain:
xm create my_config
- Connect to the console of Xen domain:
xm console my_config
- Use Ctrl-] to disconnect from a console.
Building a custom Xen kernel
Should your Domain0 kernel require some hardware drivers such as a RAID/SCSI card then you will need to customise the xen0 kernel. If one of your domains needs customisation such as traffic shaping or anything else not in the standard configuration then you need to cutomise the xenU kernel.
- Configure your custom kernel:
cd /usr/src/xen2.0/linux-2.6.11-xen0 export ARCH=xen make menuconfig
- Make your custom configuration and save it. It’s worth backing your configuration (.config) to somewhere safe since Xen could overwrite it.
- Build the custom kernel:
make all cd .. make all make install
Then return to the instructions above.
Leave a Reply
You must be logged in to post a comment.