Set up Fedora 12 (64-bit) Virtual Machine in HVM Mode on Xen


We are installing a Fedora 12 virtual machine that is going to run in HVM mode on Xen.

1. Download a DVD kernel image of Fedora 12 and create a 20GB sparse file-backed VBD
# wget http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/12/Fedora/x86_64/iso/Fedora-12-x86_64-DVD.iso
# dd if=/dev/zero of=/lhome/xen/f12install/vmdisk0 bs=1k seek=20480k count=1

2. Install a virtual machine in HVM mode
a) Configure the installation file "f12.install" as the following:/etc/xen/xmexample.hvm
name="F12INSTALL"
vcpus=2
memory=2048
disk=['file:/lhome/xen/tinyos-hvm/vmdisk0,xvda,w', 'file:/lhome/FC-6-x86_64-DVD.iso,xvdc:cdrom,r']
device_model='/usr/lib64/xen/bin/qemu-dm'
vif=['type=ioemu, bridge=xenbr0']
kernel="/usr/lib/xen/boot/hvmloader"
builder='hvm'
on_reboot='restart'
on_crash='restart'
boot="dc"
vnc=1
vnclisten="0.0.0.0"
vncconsole=1
b) Start the installation:
# xm create -c f12.install

3. Configure VNC connection to the physical host to finish the installation
a) Create port forwarding from gateway to VNC ports of the phyiscal host
# iptables -t nat -A PREROUTING -d 143.89.18.173/32 -p tcp -m tcp --dport 'forward_port_no' -j DNAT --to 'physical_host':590x
# service iptables save
b) Access the VM's GUI with VNC viewer to finish the installation:
'gateway-addr':'forward_port_no'
c) Shut down the VM when installation is done:
# xm shutdown F12INSTALL