Xen 4.2 Build From Source On RHEL CentOS Fedora
Building Xen 4.2 from source on RPM-based distributions
- These instructions have been tested on the following 64 bit Linux distributions: CentOS 5.8 x64, CentOS 6.3 x64, Fedora 17 x64. These instructions should also directly apply to Redhat Enterprise Linux (RHEL) 5.8, RHEL 6.3 and older Fedora 16.
Installing the required packages / dependencies before building the source
- use yum to install the required packages:
yum groupinstall "Development Libraries" yum groupinstall "Development Tools" yum install transfig wget tar less texi2html libaio-devel dev86 glibc-devel e2fsprogs-devel gitk mkinitrd iasl xz-devel bzip2-devel yum install pciutils-libs pciutils-devel SDL-devel libX11-devel gtk2-devel bridge-utils PyXML qemu-common qemu-img mercurial texinfo yum install libidn-devel yajl yajl-devel ocaml ocaml-findlib ocaml-findlib-devel python-devel uuid-devel libuuid-devel openssl-devel yum install glibc-devel.i686
- You need to install those packages on all the listed RPM based distributions. Copy & paste the yum commands to install the packages. Some packages might not be available on all distribution versions, but don't worry about that.
Notes for CentOS 6.3 x64
- No extra steps required with EL6. Continue to fetching and building the sources.
Notes for Fedora 17 x64
- "make tools" fails when compiling ipxe in xen-4.2.0-rc2. This is an incompatibility with ipxe and gcc 4.7 used in Fedora 17. Patches to fix this build failure in xen 4.2.0-rc2 are available here: http://lists.xen.org/archives/html/xen-devel/2012-08/msg01048.html
- Patches to fix the compilation problems are already committed to xen-unstable, so xen-4.2.0-rc3 and later versions will build without problems with gcc 4.7 and fedora 17.
- Continue to fetching and building the sources.
Notes for CentOS 5.8 x64
- EL5 is missing some required packages, such as git, yajl and yajl-devel. Install the other required packages above,
and then continue with these extra instructions before trying to compile Xen 4.2 from source.
- Install git from Fedora EPEL (Extra Packages for Enterprise Linux) repository like this:
rpm -Uvh http://ftp.df.lth.se/pub/fedora-epel/5/x86_64/epel-release-5-4.noarch.rpm yum install git
You can replace ftp.df.lth.se with your local Fedora EPEL mirror site.
- For Xen pygrub ext4 support you also need to install the following packages:
yum install e4fsprogs e4fsprogs-devel
- EL5 is also missing yajl and yajl-devel packages. Instructions how to grab yajl src.rpm from RHEL6, and recompile it for el5:
yum install cmake wget http://ftp.redhat.com/pub/redhat/linux/enterprise/6Server/en/os/SRPMS/yajl-1.0.7-3.el6.src.rpm rpm -i --nomd5 yajl-1.0.7-3.el6.src.rpm cd /usr/src/redhat/SPECS/ cp -a yajl.spec yajl.spec.orig wget http://pasik.reaktio.net/xen/patches/yajl-el6-spec-rpmbuild-fix-for-el5.patch patch -p0 < yajl-el6-spec-rpmbuild-fix-for-el5.patch rpmbuild -bb yajl.spec --define 'dist .el5' cd /usr/src/redhat/RPMS/x86_64/ rpm -Uvh yajl-1.0.7-3.el5.x86_64.rpm yajl-devel-1.0.7-3.el5.x86_64.rpm
Instructions above include a trivial fix/patch for the yajl el6 src.rpm spec-file to fix the build on el5.
- All is ready now, continue to fetching and building the sources.
Getting Xen 4.2 sources
- Check http://wiki.xen.org/wiki/Xen_4.2_RC2_test_instructions for more information.
- You can download the Xen 4.2.x tarball, or fetch the sources from Mercurial (hg) or git repositories.
Building Xen 4.2 from sources
- In this example we're using xen-4.2.0-rc2.
tar zxvf xen-4.2.0-rc2.tar.gz cd xen-4.2.0-rc2 ./configure make xen make tools make stubdom
After successful compilation the built binaries can be found under dist/install/ directory.
- Installing Xen 4.2 after succesful compilation:
make install-xen make install-tools make install-stubdom
- Note that you also need to install or build a Xen dom0 capable Linux kernel. Fedora includes Xen dom0 capable kernel out-of-the-box, but for EL5/EL6 you probably need to compile a custom kernel yourself.