How to install an Ubuntu VM under CentOS/Red Hat Xen

My process is to create the VM under Ubuntu/Gutsy and then move it across


There is an article at: which unfortunately has a number of flaws. For more information, see:

A. fix up xen-tools:

append to > /etc/xen-tools/xm.tmpl
extra = ' TERM=xterm xencons=tty console=tty1'

append to > /usr/lib/xen-tools/gutsy.d/15-disable-hwclock
rm -f ${prefix}/etc/init.d/ ${prefix}/etc/init.d/ ${prefix}/etc/udev/rules.d/85-hwclock.rules
chmod -x ${prefix}/lib/udev/set_hwclock

/etc/init.d/xend restart #restart the xend system

B. create the xen image:

xen-create-image --size=2Gb --swap=256Mb --ide \
--ip= --netmask= --gateway= --force \
--dir=/home/xen --memory=256Mb --arch=i386 --kernel=/boot/vmlinuz-2.6.22-14-xen \
--initrd=/boot/initrd.img-2.6.22-14-xen --debootstrap --dist=gutsy \
--mirror= --passwd

C. Start it to test it and also find the mac address

xm create -c /etc/xen/
ifconfig #and note the mac address
xm shutdown #then shut it down

modify /etc/xen/ to include after the mac address, e.g.:
vif = ['mac=00:16:3E:4E:B5:9B, bridge=xenbr0', 'ip=' ]

D. Copy the image and .cfg files to Centos machine

/usr/sbin/xm create -c /etc/xen/ #start it up
(this seems a more reliable method of starting it than using the virtual manager gui)

E. Install extras on the image

#upgrade server to desktop
apt-get update
apt-get upgrade
aptitude install ubuntu-desktop

Install NX server so as to be able to log into a desktop from another machine (MUCH better than VNC)
Info from this page:

see here for installation:

apt-get install kubuntu-desktop #I prefer kubuntu installed over the top of ubuntu

-Notes on mount:
mount -o loop -t iso9660 filename.iso /mnt/iso
mount -o loop -t ext3 /home/xen/domains/ /mnt/xen1

F. Move image based VM into an LVM based VM (much more efficient

See here: for details