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

Resources

There is an article at: http://www.howtoforge.com/ubuntu-8.04-server-install-xen-from-ubuntu-rep... 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 --hostname=amfh.isnew.org --size=2Gb --swap=256Mb --ide \
--ip=192.168.1.121 --netmask=255.255.255.0 --gateway=192.168.1.1 --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=http://archive.ubuntu.com/ubuntu/ --passwd

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

xm create -c /etc/xen/amfh.isnew.org
ifconfig #and note the mac address
vi /etc/xen/amfh.isnew.org.cfg # in Dom0 and add using your own mac address (this was already done):
vif = [ 'ip=192.168.1.20,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 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

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=192.168.1.121,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/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
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: http://www.nomachine.com/download-package.php?Prod_Id=6 )
wget http://64.34.161.181/download/3.2.0/Linux/nxclient_3.2.0-14_i386.deb
wget http://64.34.161.181/download/3.2.0/Linux/nxnode_3.2.0-13_i386.deb
wget http://64.34.161.181/download/3.2.0/Linux/FE/nxserver_3.2.0-16_i386.deb
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/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