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

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


There is an article at: which is the basis, but *don't do the wget and dpkg steps* since the patches are now in hardy

A. Work in Dom0:

apt-get install python.xml

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.24-19-xen \
--initrd=/boot/initrd.img-2.6.24-19-xen --install-method=debootstrap --dist=hardy \
--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
vi /etc/xen/ # in Dom0 and add using your own mac address (this was already done):
vif = [ 'ip=,mac=00:16:3e:be:6c:1c' ]

vi /etc/network/interfaces # add/uncomment the line: post-up ethtool -K eth0 tx off gso on #turn off tx-checksumming
vi /etc/network/interfaces # only need to do this for DHCP:
auto eth0
iface eth0 inet dhcp

apt-get remove network-manager #in case it is installed

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

Make a copy of the cfg file and do the following modifications:
'phy:/dev/VolGroup00/vm_amfh,hda2,w', #change the .img file references to LVMs (being consistent with the hda #'s)
vif = [ 'ip=,bridge=xenbr0,mac=00:16:3E:BE:6C:1C' ] # add the bridge parameter in the vif
increase the memory if required
/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
apt-get install vim-full
aptitude install ubuntu-desktop

Install NX server so as to be able to log into a desktop from another machine (MUCH better than VNC):
(These links are from the page: )
dpkg -i nxclient_3.2.0-14_i386.deb
dpkg -i nxnode_3.2.0-13_i386.deb
dpkg -i nxserver_3.2.0-16_i386.deb
vi /usr/NX/etc/node.cfg & server.cfg
change: #SSHD_Port=22 to SSHD_Port=xxxx # or whatever
vi /etc/ssh/sshd_config
and add Port xxxx under Port 22
/etc/init.d/ssh restart
/etc/init.d/nxserver restart
apt-get install kubuntu-desktop #I prefer kubuntu installed over the top of ubuntu
adduser andrew #to add new users
visudo # to give sudo priv

-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