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

Resources

There is an article at: http://www.howtoforge.com/ubuntu-7.10-server-install-xen-from-ubuntu-rep... 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/hwclock.sh ${prefix}/etc/init.d/hwclockfirst.sh ${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 --hostname=xen1.example.com --size=2Gb --swap=256Mb --ide \
--ip=192.168.1.14 --netmask=255.255.255.0 --gateway=192.168.1.1 --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=http://de.archive.ubuntu.com/ubuntu/ --passwd

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

xm create -c /etc/xen/xen1.example.com.cfg
ifconfig #and note the mac address
xm shutdown xen1.example.com #then shut it down

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

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

/usr/sbin/xm create -c /etc/xen/xen2.example.com.cfg #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: http://www.nomachine.com/download-package.php?Prod_Id=359

see here for installation: http://drup.org/installing-nx-server

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/xen1.example.com/disk.img /mnt/xen1

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

See here: http://quadruple.ca/lvm-commands for details