Howto setup Xen 4.1 with Ubuntu 11.10 and run a VM (domU)

Ubuntu 11.10  released with the Linux 3.0.0. Now Linux  has the Xen dom0 support.

setup steps:

1. Install Xen hypervisor

apt-get install xen-hypervisor-4.1-amd64

2. create a domU configuration. ( node0.cfg )

disk = [ 'file:/mnt/vm/xen/vm_images/node0.iso,hda,w',
'file:/media/mnt/vm/xen/iso_files/oneiric-desktop-i386.iso,hdc:cdrom,r' ]

memory=1024 vcpus=1 name="node0"
vif=[ 'type=ioemu,bridge=virbr0' ]
builder = "hvm"
device_model = "/usr/lib/xen-4.1/bin/qemu-dm"
vnc=1 vncunused=1
apic=0
acpi=0
pae=0
serial = "pty" # enable serial console
boot="dc"
on_reboot = 'restart'
on_crash = 'restart'

3. Start the domain

xm create /pathto/node0.cfg

In the first boot vm boots from cdrom and user can install new OS to vm.
by changing the boot order to boot=”c” user can boot from the hard disk.

4. List running domains.

xm list

PS:
Ubuntu 11.10 still need some path fixes to run user domains /vms ( domU ).
You may get an error in your /var/log/qemu-dm-node0.log saying :

Could not read keymap file: ‘/usr/share/qemu/keymaps/en-us’
create symbolic link named qemu-linaro in /usr/share with the name qemu.

For bridge networks default bridge may not include your default NIC.
If your vms ( domUs ) can not communicate with out side networks add
NIC to bridge.

brctl addif virbr0 eth0


How to Install xen-3.4 with latest kernel ( 2.6.31.12 )

Download the Latest Linux kernel

#wget  http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.31.12.tar.bz2

Download the latest xen patch set

# wget  http://gentoo-xen-kernel.googlecode.com/files/xen-patches-2.6.31-10.tar.bz2

Apply the patch set

Build and install the kernel

Download the latest Xen source

# hg clone http://xenbits.xensource.com/xen-3.4-testing.hg

Build and install  Xen resources

# make install-xen
# make install-tools
# make install-stubdom

More xen building stuff