DTC-Xen Installation

DTC-Xen / Dom0 Howtos

DTC-Xen / DomU Howtos


DTC Howtos




Devel docs

Wiki - i18n

Wiki - Meta

Building Xen yourself (highly outdated)

Downloading and unpacking the kernel and Xen

Go to an empty folder and download the latest stable sources. Example:

   cd /usr/src


You can also try the new version:(I used this one and works)


Now clone the latest Linux 2.6.18 from the Xen Mercurial repository:

   apt-get install mercurial

   hg clone

This one is a temporary one (before Xen reaches the upstream kernel) that could work too:

but then you will have to edit mk.linux-2.6-xen so it has the correct version.

The hg command is in the mercurial package. This downloaded kernel is NOT the standard 2.6.18, it includes MANY patches not only for Xen, like support for the ICH8 SATA controler and others (like security patches). But unfortunately, this does NOT include enough security patch -- I was able to add about 111 bugfix patches from the Debian 2.6.18 kernel patch set. Here is an archive that I did, taking the bugfix folder from the package linux-patch-debian-2.6.18, and removing the patches that failed. This include the famous vmsplice patch. You're going to get those now:

I tried with these patches but when building the xen kernel, it always failed. I recommend not to use them.


Unpack it, then cd to linux-2.6.18-xen.hg and type:


Xen will then compile using this rather more secure kernel. In the future, you HAVE to watch carefully the debian-security mailing list to watch for future patches and apply them again.

Unpack all the tarballs you downloaded.

Preparing the system to compile the Xen kernel

It's time for you to get all the things you need to compile. Here's my one time apt-get command:

apt-get install make gcc libc6-dev zlib1g-dev python python-dev python-twisted bridge-utils iproute libcurl3 libcurl3-dev bzip2 module-init-tools transfig tgif libncurses5-dev patch libvncserver-dev libsdl-dev libjpeg62-dev bcc bin86 gawk pciutils-dev

If you use Lenny, you will also need:

libc6-dev-i386 texinfo

This will download as well the things needed to compile Xen with HVM support (VMX), the hardware assisted emulation that can run Windows (for example). Now, just type:

Now, change into the Xen directory and run the following command:

   cd xen-3.2.1
   make world KERNELS="linux-2.6-xen0 linux-2.6-xenU"

and this will compile everything for you (a domU and a dom0 kernel). If you need to configure your kernel first, follow the next section:

Customizing the kernel

The way to configure your dom0 kernel is easy:

   make linux-2.6-xen0-config CONFIGMODE=menuconfig

You can do the same for domU:

   make linux-2.6-xenU-config CONFIGMODE=menuconfig

Add all the hardware drivers that you need as usual, and don't forget to check for the support of RAID1 and LVM2 (which is called device mapper in the kernel).

As per default, many things has to be changed. Namely, you need to have support for iptables, but also physdev match (if you want to use the anti-spoof facility of Xen), QoS (all the options), pf_key and other routing facilities. Note that you might need to compile all the modules needed by the Xen domU in your dom0, I have noticed once that a domU kernel module didn't work if it was not compiled in the dom0 as well, which shouldn't be the case, but this is what I could experience. If you want to satisfy all of your customers, best is to compile all the network options you can, and if you want to be able to access to the file systems of guest OS, it can be nice to have support for things like NetBSD fs, NTFS and others. The dom0 is the most important kernel to configure, as there is always the possibility to customize the domU kernel later, when your box is ready and in the data center (no need for a hardware reset for your domU kernel).

Somebody wrote here: 'This section should be enlarged upon to explain exactly which things should be changed from defaults. It is reasonable to assume that most readers of this article will not be experienced in kernel tweaking'. I have to reply that this goes bellow the scope of this document, we can't simply teach you how the kernel works, and what option to activate, it's just a too big topic... But make sure to activate (most) things in the network options (like iptables, advanced router, bridging, phy infrastructure and xtables filtering, etc.).

Once you are happy with the configuration, you can build the kernel:

   make dist KERNELS="linux-2.6-xen0 linux-2.6-xenU"

And install with

   make install KERNELS="linux-2.6-xen0 linux-2.6-xenU"

Once you are satisfied, go on the toplevel folder of the xen sources, and type make install

Don't forget you can always do this later on:

   make linux-2.6-xenU-config CONFIGMODE=menuconfig
   make linux-2.6-xenU-build
   make linux-2.6-xenU-install

or also:

   make linux-2.6-xen0-config CONFIGMODE=menuconfig
   make linux-2.6-xen0-build
   make linux-2.6-xen0-install


Make sure that the device is the correct one (root=/dev/md0) Some times its not always md0, it could be md2. Check in the menu.lst and verify the correct device. If you use the wrong one, when booting into your new kernel, you will get a Kernel Panic.

Edit /boot/grub/menu.lst -- and set the first option to be something like this:

   title           Xen 3.0 / XenLinux 2.6
   kernel          /boot/xen-3.2.1.gz dom0_mem=393216
   module          /boot/vmlinuz- root=/dev/md0 ro console=tty0 max_cpus=1

   ## ## End Default Options ##

   title           Debian GNU/Linux, kernel 2.6.8-2-386
   root            (hd1,0)
   kernel          /boot/vmlinuz-2.6.8-2-386 root=/dev/md0 ro
   initrd          /boot/initrd.img-2.6.8-2-386

As you see, you should set the xen kernel BEFORE the ## ## End Default Options ##. This way, the debian system wont overwrite it. Note that my experience showed that something lower than 192MB for the dom0 is to avoid, and 384MB seems to be a quite good value when running with dtc-xen.

Double, and even triple check that your kernel version number correspond to what you have just compiled (and that should be now located in your /boot).

If not done before, you can install grub on both disks:

   grub --no-floppy
   root (hd0,0)
   setup (hd0)
   root (hd1,0)
   setup (hd1)

Now you can reboot. After you have reboot in your new xen kernel, you have to:

   update-rc.d xend defaults 20 21
   update-rc.d xendomains defaults 21 20

and start xend:

   /etc/init.d/xend start

That's it, you are done with the basic OS setup.

Page last modified on December 05, 2009, at 03:27 AM EST