After spending hours of figuring out how to get Xen virtualization on the latest Ubuntu done as simply as possible, here are the results. Hopefully they are helpful to you.
1) Install packages
$ sudo apt-get install xen-hypervisor-4.1-amd64 xen-tools
2) Reboot with Xen
Note that there will be a two-stage grub menu. First choose Xen, then choose the kernel from the second menu.
Press ESC during boot to see the menu in the first place if it is hidden.
3) Check that Xen (Dom0) works
$ sudo xm list Name ID Mem VCPUs State Time(s) Domain-0 0 15289 8 r----- 126.5
4) Fix xen-tools
$ sudo cp -R /usr/lib/xen-tools/karmic.d \ /usr/lib/xen-tools/oneiric.d $ sudo rm /usr/lib/xen-tools/oneiric.d/70-install-ssh
This is needed because as of today, the next step will fail due to some strange umount problem related to ssh. There is no need to install ssh immediately, as it can be done later from the console (step 7).
5) Create a virtual machine (DomU) running Ubuntu 11.10 amd64
$ sudo xen-create-image \ --memory=1G --size=10G --swap=1G \ --dist=oneiric --install-method=debootstrap \ --dir=/home/xen --hostname=xen1 --dhcp
Configuration will be stored in /etc/xen/xen1.cfg, virtual disks in /home/xen/domains/xen1.
Write down the random root password from the installation report.
6) Start up the new virtual machine with console
$ sudo xm create xen1.cfg -c
You can exit the console by pressing CTRL + ALTGr + ‘}’
You can enter the console later with ‘xm console xen1’.
7) Update (and install) packages in the virtual machine
root@xen1:~# apt-get update && apt-get dist-upgrade root@xen1:~# apt-get install openssh-server
8) You’re done.
To shut down the virtual machine from its (ssh) console:
root@xen1:~# halt -p
To later start the virtual machine:
$ sudo xm create xen1