Xen dom0 on Debian Squeeze with CentOS domU

Update : With Cen­tOS 5.6, you need upda­ted rinse package. You can  pick up ver­sion >= 1.8.1 from Debian Tes­ting repo­si­tory. Other­wise, you can add libu­ser, passwd and python-libs to /etc/rinse/centos-5.packages inside dom0 and run “cp /etc/modprobe.d/modprobe.conf.dist /etc/modprobe.conf” inside domU, just before the mki­ni­trd step.

Here are some hints for set­ting up Xen dom0 (ser­ver) on Debian Squeeze and run­ning Cen­tOS domU (guest in Xen ter­mi­no­logy) on it. This pro­ce­dure makes use of rinse tool, a deboots­trap equi­va­lent for CentOS.

First, fol­low this Debian wiki page for basic setup of the ser­ver. Debian recomm­mends to set up a net­work bridge by fol­lo­wing the ins­truc­tions in the man­page for bridge-utils-interfaces(5) ins­tead of uncommenting

(network-script network-bridge)

in /etc/xen/xend-config.sxp.
You are now ready to create the image:

xen-create-image --hostname hostname.yourdomain --ip 192.168.0.1 --scsi --vcpus 2 --pygrub\
 --install-method=rinse --dist centos-5

You can now mount the xen domU par­ti­tion, I will assume you use LVM for domU:

mount /dev/vg_xen/hostname.yourdomain-disk /mnt

We also need those pseudo file systems:

mount -o bind /proc /mnt/proc
mount -o bind /sys /mnt/sys

Then, chroot into it:

chroot /mnt
touch /etc/mtab
touch /etc/fstab

Ins­tall Cen­tOS Xen kernel:

yum install kernel-xen

Rebuild ini­trd with requi­red Xen dri­ver (block and net­work device)

mkinitrd --with=xenblk --with=xennet --preload=xenblk --preload=xennet\
 -f /boot/initrd-2.6.18-194.26.1.el5xen.img 2.6.18-194.26.1.el5xen

Create /boot/grub/menu.lst:

# WARNING : Don't forget to update this when you upgrade kernel !
# You can also exclude kernel-xen from updates by putting
# exclude=kernel-xen in in [main] in yum.conf

default=0
timeout=5
title CentOS (2.6.18-194.26.1.el5xen)
kernel        /boot/vmlinuz-2.6.18-194.26.1.el5xen
initrd        /boot/initrd-2.6.18-194.26.1.el5xen.img

Open the ini­t­tab file and add the fol­lo­wing line to it

co:2345:respawn:/sbin/mingetty console

and com­ment the fol­lo­wing lines as shown below.

#1:2345:respawn:/sbin/mingetty tty1
#2:2345:respawn:/sbin/mingetty tty2
#3:2345:respawn:/sbin/mingetty tty3
#4:2345:respawn:/sbin/mingetty tty4
#5:2345:respawn:/sbin/mingetty tty5
#6:2345:respawn:/sbin/mingetty tty6

If that does not work, try repla­cing tty with console to the line spe­ci­fying getty or min­getty like given below.

5:2345:respawn:/sbin/mingetty console

Set cor­rect timezone:

ln -sf /usr/share/zoneinfo/Europe/Brussels /etc/localtime

Ins­tall root bash config files:

cp -p /etc/skel/.* /root

Exit chroot:

<Ctrl-D>

Unmount domU file systems:

umount /mnt/proc
umount /mnt/sys
umount /mnt

Boot the domU with “-c” option to open console:

xm create -c /etc/xen/hostname.yourdomain.cfg

You can exit console with “Ctrl + ]”.
You can enter console again with

xm console hostname.yourdomain

Ins­tall impor­tant mis­sing packages:

yum install bind-utils file glibc man man-pages iptables mailx mc openssh-clients tcpdump telnet\
    traceroute sysklogd zip unzip wget vixie-cron xauth

Enable and start syslog:

chkconfig syslog on
/etc/init.d/syslog start

Enable and start crond:

chkconfig crond on
/etc/init.d/crond start

You can ins­tall option­nal package groups as needed:

yum grouplist
yum groupinstall "Development Libraries" "Development Tools" "X Software Development"\
    "Legacy Software Development"

To list Xen dom:

xm list

To stop domU:

xm destroy hostname.yourdomain
Par­ta­ger et décou­vrir :
  • del.icio.us
  • Digg
  • Slashdot
  • StumbleUpon
  • Facebook
  • Google Bookmarks
  • Technorati
  • Twitter
  • Yahoo! Bookmarks
This work, unless other­wise expressly sta­ted, is licen­sed under a Crea­tive Com­mons Attribution-Share Alike 2.0 Bel­gium License.

3 réponses à “Xen dom0 on Debian Squeeze with CentOS domU”


  • Thank you for this article, but you have a typo, it’s python-libs, not python-lib.

    In order to ins­tall a cen­tos 5 domU on a debian squeeze domu, I have added the fol­lo­wing package to the file /etc/rinse/centos-5.packages

    libu­ser
    passwd
    python-libs

  • Thanks for this, there isnt as much info on a cen­tos domU hos­ted on a Debian dom0 as the other way around.

    Any idea how to make this a lit­tle more auto­ma­ted with pro­vi­sio­ning cen­tos domU’s ? What hap­pens with ker­nel upgrades on the domU? Do we have to manually run mki­ni­trd each time or can it be set to do this automatically?

  • You could turn this into tem­plate via simple tar.gz archive for example.
    You will have to run mki­ni­trd on ker­nel update. That’s why I prevent auto­ma­tic ker­nel update with “exclude=kernel-xen” in /etc/yum.conf. You can try to put
    alias eth0 xen­net
    alias scsi_hostadapter xen­blk
    into /etc/modprobe.d/xen.conf. This should include dri­vers into ini­trd.
    Any­way you still have to update menu.lst but there should be a way to do it automatically.

Laisser un commentaire