I have done this with Hardy (should be a similar process for Gutsy) following these steps:
1. Install the debootstrap RPM from Fedora development in Dom0
2. Create the devices to use as disks and mount the root partition in the Dom0. In my case I use LVM.
Code:
# lvcreate -n ubuntu -L10G /dev/vgxen
# lvcreate -n ubuntu-swap -L256M /dev/vgxen
# mke2fs -j /dev/vgxen/ubuntu
# mkswap /dev/vgxen/ubuntu-swap
# mkdir -p /mnt/xen
# mount /dev/vgxen/ubuntu /mnt/xen
3. Debootstrap a system. Make sure to include extra repositories (multiverse, universe) and tell it to include the correct linux-image-xen, modules, libc6-xen and grub packages. Use a mirror closer to you:
Code:
# debootstrap --arch=i386 --include=linux-image-2.6.24-16-generic,linux-image-2.6.24-16-xen,linux-ubuntu-modules-2.6.24-16-xen,linux-image-xen,libc6-xen,grub --components=main,universe,multiverse hardy /mnt/xen http://mirror.3fl.net.au/ubuntu/
4. Once that has finished chroot into the new debootstrapped tree for the next round of changes.
Code:
# chroot /mnt/xen
# export LANG=C
5. Disable TLS libc libraries:
Code:
# mv /lib/tls /lib/tls.disabled
6. Create /etc/fstab:
Code:
# cat /etc/fstab
/dev/xvda1 / ext3 defaults 0 1
/dev/xvdb1 none swap defaults 0 0
proc /proc proc defaults 0 0
7. Create a folder for GRUB menu and update the config. This is the reason you install the linux-image-generic package:
Code:
# mkdir -p /boot/grub
# update-grub
8. Edit /boot/grub/menu.lst
- replace "-generic" with "-xen"
- remove "quiet splash" from the kernel line
- add "console=xvc0" to both kernel lines (normal and recovery mode)
9. Setup a getty on the Xen console (xvc0):
Code:
# cd /etc/event.d
# cp tty1 xvc0
# sed -i -e "s/tty1/xvc0/g" xvc0
10. Add xvc0 to /etc/securetty to allow root to login
11. Remove references to the hardware clock; these will cause the DomU to hang:
Code:
# update-rc.d -f hwclockfirst remove
# update-rc.d -f hwclock remove
# rm /etc/udev/rules.d/85-hwclock.rules
12. Configure network interfaces (/etc/network/interfaces). In my setup I have DHCP, set static information if you require it:
Code:
# cat /etc/network/interfaces
# Used by ifup(8) and ifdown(8). See the interfaces(5) manpage or
# /usr/share/doc/ifupdown/examples for more information.
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
13. Create /etc/hosts file
Code:
# cat /etc/hosts
127.0.0.1 localhost
127.0.1.1 hardy
14. Create /etc/hostname file
Code:
# cat /etc/hostname
hardy
15. Exit chroot and unmount the filesystem.
Code:
# exit
# umount /mnt/xen
16. Create DomU configuration. Because you have installed a kernel in DomU you can use pygrub:
Code:
# cat /etc/xen/ubuntu
bootloader = '/usr/bin/pygrub'
memory = 256
name = "ubuntu"
vif = [ '' ]
disk = [ 'phy:/dev/vgxen/ubuntu,xvda1,w', 'phy:/dev/vgxen/ubuntu-swap,xvdb1,w' ]
Start your DomU and it should be all good! There is a bug with Hardy at the moment where the network driver will cause a kernel panic on ifup, but the kernel from the Bug Tracker will resolve that - it can be installed while in the chroot.