Xen Host (dom0)

KVM is nice and all, but not all servers I'd like to run virtual guests on have virtualization capable processors. Also, Xen makes it simple to set up guests without any sort of requirement for a GUI. These are instructions for setting up an Ubuntu server as a Xen host.


Installation

  • Install Ubuntu server edition.
manually partition: 20 GB root, the rest as LVM but leave 1-2 GB swap at the end
  • Disable the MOTD
rm /etc/motd
touch /etc/motd
  • Disable apparmor

/etc/init.d/apparmor stop

update-rc.d -f apparmor remove
  • Update apt and install some useful stuff
apt-get update
apt-get dist-upgrade
apt-get install vim


Setup Xen

  • edit /etc/modules to allow for more than the default number of domU's
loop max_loop=64
  • install Xen and LVM then reboot
apt-get install ubuntu-xen-server lvm2
init 6
  • edit /etc/default/xendomains so guest domains shutdown when the host service stops.
XENDOMAINS_SAVE=""
  • Setup LVM
pvcreate /dev/sda2
vgcreate vg /dev/sda2
  • copy the contents of any install CD ISOs you want to use for xen-tools installs
mount -o loop /path/to/hardy.iso /mnt
rsync -av /mnt/ /hardy_media
  • edit /etc/xen-tools/xen-tools.conf, important options are the following:
lvm = vg
install-method = debootstrap
size   = 10Gb     # Disk image size.
memory = 512Mb    # Memory size
swap   = 256Mb    # Swap size
dist   = hardy    # Default distribution to install.
image  = full     # Specify sparse vs. full disk images.
gateway   = 192.168.1.1
netmask   = 255.255.255.0
broadcast = 192.168.1.255
cache = no
passwd = 1
arch=amd64
mirror_hardy = file:///hardy_media
ext3_options   = relatime,errors=remount-ro
ext2_options   = relatime,errors=remount-ro
boot = 1

It's important to now go to /usr/lib/xen-tools and make sure you understand everything happening in hardy.d (create them if they don't exist using another as an example). It seems to duplicate some Ubuntu things and may do unnessary things for your environment. I prefer to gut it and build up.

  • The only scripts that are necessary are:
01-disable-daemons
31-ubuntu-setup
40-setup-networking
50-setup-hostname
80-install-modules
90-make-fstab
99-enable-daemons

You might want to modify 20-setup-apt to update and get some default packages installed.

Also check /usr/share/debootstrap/scripts, no modification should be necessary except perhaps to create a symlink for jaunty:

ln -s gutsy /usr/share/debootstrap/scripts/jaunty

Once you're done, move on to creating a Xen guest!


Back to top
ubuntu/xen_host.txt · Last modified: 2009/08/14 09:25 by sainth