Archives pour le mot-clé «xen»

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 --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

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:


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