Building Xen From Source¶
Most users should install Xen through their Linux distribution’s packages — see Getting Started. Build from source instead if you need an unreleased version, want to enable a feature your distribution disabled at build time, or are developing Xen itself.
Getting the source¶
Either download a release tarball from the downloads page, or clone the git repository directly:
git clone https://xenbits.xen.org/git-http/xen.git
See Project Repositories in the Contributor Handbook for the branch layout (master, stable-X.Y, release tags).
Prerequisites¶
You need a C compiler and linker (GCC or Clang), GNU Make, and development packages for zlib, Python, curses, uuid, and one of json-c or yajl, plus several other libraries. The exact list changes between releases, so treat it as authoritative only from the source tree itself: it’s in the README file at the top level, alongside the fuller INSTALL file.
Most distributions also offer a shortcut that pulls in whatever their own Xen package was built with, for example:
apt-get build-dep xen # Debian / Ubuntu
dnf builddep xen # Fedora / RHEL / CentOS
This can drift from what a newer source tree actually needs, so cross-check against the README if the build fails on a missing dependency.
A dom0 kernel is a separate requirement. Use the kernel your distribution provides if it supports Xen; only build one from source if it doesn’t.
Building and installing¶
From the top of the source tree:
./configure
make world
make install
make world performs a clean build of the hypervisor, tools, and documentation; make install installs onto the local machine, including distribution-appropriate files such as udev rules. Run ./configure --help to see optional features — for example --enable-systemd if the target system uses systemd.
To rebuild an existing tree without repeating the full clean build, use make dist instead, which places a self-contained tree in dist/ that you can copy to another machine and install from. Override the install location with the DESTDIR (for make install) or DISTDIR (for make dist) variables.
xenstore backend¶
Xen ships two implementations of xenstore, the configuration database shared between domains: xenstored (C) and oxenstored (OCaml). oxenstored is used by default when OCaml development tools are available at build time. Choose explicitly with:
./configure --with-xenstored=xenstored
./configure --with-xenstored=oxenstored
Both are built and installed regardless of this default; which one runs is controlled separately in /etc/default/xencommons (or /etc/sysconfig/xencommons), and changing it requires a reboot to take effect.
After installing¶
Enable the required system services and reboot. On systemd:
systemctl enable xen-qemu-dom0-disk-backend.service
systemctl enable xen-init-dom0.service
systemctl enable xenconsoled.service
xendomains.service, xen-watchdog.service, and xendriverdomain.service are optional, depending on whether you want guests to resume automatically, a hypervisor watchdog, or driver domain support.