XAPI on Ubuntu

From Xen
Revision as of 19:19, 17 November 2011 by MikeCamel (talk | contribs) (Started moving old wiki details to this version.)

Installing Xapi on Ubuntu Oneiric

This is Project Kronos. Follow theses instructions to get xapi, the XenAPI server daemon, installed on an Ubuntu Oneiric box, using the upstream Linux kernel. This will effectively allow you to turn an existing Ubuntu machine into an XCP host. Note that this is *very much* a work-in-progress. Some features will be broken, and there will be a bit of manual configuration required. We appreciate any testing you do for this project, but please don't consider this production ready yet! Please visit the Kronos Supported Features page for a list of XCP features that are known to work on Kronos.


An important note: don't be tempted to install any kernel (via apt, for instance) which ends in "-virtual" during this process. Such kernels are intended to run as Guests (that is, "VMs"), and are not configured to be used as the Dom0 kernel. You will run into particular problems if you try this on a system which uses an Nvidia card, as the nvidia-current drivers do not currently seem to compile against these kernels, and you will therefore not be able to start X correctly. Given the standard Oneiric start up and splash screens, this isn't a particularly easy problem to fix, so avoid it in the first place! Another important note: the instructions on this page assume that:

  • you know what you are doing with Linux, and are able to repair any issues that might arise as a result of following (or mis-following...) the instructions;
  • you are running as root. If you don't know what this entails, then see 1. above, and seek further help from the community before proceeding.

1. Install Ubuntu Oneiric

Kronos will work with either Ubuntu Oneiric Server or Desktop, with the default kernel. If you want to use local storage, you will have to reserve an unformatted partition on your hard disk for xapi. In a later step, you will use this partition to create a local storage repository.

2a. Set up the Kronos PPA ...or...

add-apt-repository ppa:ubuntu-xen-org/xcp

2b. ... Use a Kronos Debian repository

apt-get install curl echo "deb http://downloads.xen.org/XCP/debian/repo/debian unstable main" > /etc/apt/sources.list.d/kronos.list echo "deb-src http://downloads.xen.org/XCP/debian/repo/debian unstable main" >> /etc/apt/sources.list.d/kronos.list wget --quiet -O - http://downloads.xen.org/XCP/debian/xcp.gpg.key | apt-key add - 

3. Install xapi

This step installs XCP's xapi and all its dependencies, including the Xen hypervisor.

apt-get update
apt-get install xapi

Once you've installed these packages, you can just do an `apt-get update && apt-get upgrade` to keep up with the latest builds.

4. Post-install setup

  • a) Optional: Make xen the default grub entry.

sed -i 's/GRUB_DEFAULT=""/GRUB_DEFAULT="Xen 4.1-amd64"/' /etc/default/grub

b. Setup the network/interfaces file:

cat > /etc/network/interfaces <<EOF 
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo xenbr0
iface lo inet loopback

# The primary network interface
iface eth0 inet manual

iface xenbr0 inet dhcp
	bridge_ports eth0


c. Setup the xensource-inventory file:


cat > /etc/xensource-inventory << EOF

5. Reboot.

Using XCP

Set up your path:

export PATH=$PATH:/usr/lib/xen-common/xapi/bin

Edit the /etc/xensource-inventory file to add your main interface as the management interface, and to tell the storage plugins where your main filesystem is located. It should have lines in approximating the following:


Set up a storage repository. For now, I recommend NFS, or EXT if you have an unused block device. For example:

SR=`xe sr-create type=nfs name-label=nfs device-config:server=<nfs server> device-config:serverpath=<path on server>`


SR=`xe sr-create type=ext device-config:device=/dev/sda3 name-label=ext`

Set this as pool default SR:

POOL=`xe pool-list --minimal`
xe pool-param-set uuid=$POOL default-SR=$SR

To install windows, you'll need an iso. These can be served by an NFS server. Try this:

xe-mount-iso-sr nfs-server:/path/to/isos

Then create a windows VM:

xe vm-install template=Windows\ 7\ \(32-bit\) new-name-label=windows
xe vm-cd-add vm=windows cd-name=win7.iso device=3
xe vm-start vm=windows

To get networking working, you'll need to manually set up the bridge:

brctl addbr xenbr0
brctl addif xenbr0 eth0

You may need to move the IP address to the bridge rather than the physical interface. Having done this, try a pif-scan:

xe pif-scan

This might create the network for your interface.

PV drivers for Windows

wget http://downloads.xen.org/XCP/debian/xs-tools-5.9.960.iso
mv xs-tools-5.9.960.iso /usr/lib/xen-common/xapi/packages/iso

After doing this, rescan the SR to pick up the new ISO.

Compiling from source

The easiest way to compile the XCP toolstack from source is to use the xapi-autobuilder.

First install the perquisites:

apt-get install pbuilder debhelper dh-ocaml dh-autoreconf cdebootstrap python-debian mercurial git
wget http://downloads.xen.org/XCP/debian/blktap-dkms_0.1_all.deb
dpkg -i blktap-dkms_0.1_all.deb

Then clone xapi-autobuilder and build:

git clone https://github.com/jonludlam/xapi-autobuilder.git
cd xapi-autobuilder
make clean ; make

This will build all of the required Debian packages for Xapi (except for vncterm, which is only available as a binary until we sort out licensing issues). Take a look at xapi-autobuilder/build.sh to see what's going on inside. You can modify the files git-repos and hg-repos to point to your own repositories if you plan on compiling your own code. If you only want to build a subset of the packages, comment out the ones you don't want to build from the build.sh script.

You can manually download all of the latest packages and source packages using:

wget -r -l1 --no-parent -nd http://downloads.xen.org/XCP/debian/latest/
rm index.html*