Install Xen in Debian Linux

Posted on 9:17 PM by Bharathvn

My assumptions here are that you have a free partition named /dev/hda5 which you can use for setting up a LVM partition.

The following values can offcourse be changed suited to your needs:


-L at lvcreate to set size for your partitions

memory = in /etc/xen/domu1 to set memory size for the domU

The domU uses kernel "/boot/vmlinuz-2.6.11-xenU", because this document was written with Xen 2.0.7 installed. This setup however also works up until the last Xen unstable (3.0) version. The domU kernel line changes into the kernel supplied by the Xen version of your choice.

* install the base system:

apt-get install lvm2
pvcreate /dev/hda5
vgcreate lvmxen /dev/hda5
lvcreate -L1G -n domu1 lvmxen
lvcreate -L256M -n domu1-swap lvmxen
mke2fs /dev/lvmxen/domu1
tune2fs -j /dev/lvmxen/domu1
mkswap /dev/lvmxen/domu1-swap
mount /dev/lvmxen/domu1 /mnt
debootstrap sarge /mnt

# It can be possible that debootsrap spits out an error message
# like: E: Couldn't find these debs: 33024830
# use the following command line for debootstrap if this is the case.
# debootstrap --resolve-deps sarge /mnt

mv /mnt/lib/tls /mnt/lib/tls.disabled


put in /mnt/etc/network/interfaces:

auto lo
iface lo inet loopback


put in /mnt/etc/fstab:

# /etc/fstab: static file system information.
proc /proc proc defaults 0 0
/dev/hda1 / ext3 defaults,errors=remount-ro 0 1
/dev/hda2 none swap sw 0 0

* create ttys

cd /dev
./MAKEDEV tty1 tty2 tty3 tty4 tty5 tty6

* unmount the newly created domU

cd /
umount /mnt


create a /etc/xen/domu1 file, for example:

# -*- mode: python; -*-
kernel = "/boot/vmlinuz-2.6.11-xenU"
memory = 128
name = "domu1"
vif = [' bridge=xen-br0' ]
disk = ['phy:/dev/lvmxen/domu1,hda1,w','phy:/dev/lvmxen/domu1-swap,hda2,w']
hostname = "domu1"
root = "/dev/hda1 ro"
extra = "4"


start the domU with xm create domu1 -c

log in as root, run base-config, happy xenning :-)


for a xen 3.0.0 source install, the /etc/xen/domu1 file must have the following values changed in /etc/xen/domu1:

* kernel = "/boot/vmlinuz-2.6.12-xen" vif = [' bridge=xenbr0' ]