You can do this many different ways:
- Install Xen through Yum
- Download prebuilt Xen RPMs & install them
- Download the Xen source and compile & install Xen
Installing Xen through Yum
The easiest is just to install Xen through yum: It’s a simple
yum install xen
And let Yum churn away at it:
[root@caesium ~]# yum install xen Loaded plugins: langpacks, presto, refresh-packagekit Adding en_US to language list Setting up Install Process >Clipped for brevity< Installed: xen.i686 0:4.0.1-7.fc14 Dependency Installed: PyXML.i686 0:0.8.4-25.fc14 SDL.i686 0:1.2.14-10.fc14 bridge-utils.i686 0:1.2-9.fc13 qemu-common.i686 2:0.13.0-1.fc14 qemu-img.i686 2:0.13.0-1.fc14 xen-hypervisor.i686 0:4.0.1-7.fc14 xen-libs.i686 0:4.0.1-7.fc14 xen-licenses.i686 0:4.0.1-7.fc14 xen-runtime.i686 0:4.0.1-7.fc14 Complete!
One of the benefits of using Yum is that it automatically resolves dependencies for you – it didn’t just install Xen, it also installed all the necessary packages.
Downloading prebuilt Xen RPMs & Installing them
Of course, if your Xen host is isolated from the internet, yum isn’t going to work. So the next easiest thing to do is to grab the prebuilt Xen RPMs from the automated Fedora package builder, Koji. It has a specific section for Xen RPMs. Download the bunch of them for your system (either i686 or x86_64 – if you’re not sure, do a uname -r
on your Xen host. It should be listed at the very end of what’s printed.)
Unfortunately, you can’t just install all the RPMs straightaway.
[root@caesium ~]# rpm -Uvh xen-*.rpm error: Failed dependencies: PyXML is needed by xen-4.1.0-1.fc15.i686 bridge-utils is needed by xen-4.1.0-1.fc15.i686 liblzma.so.5 is needed by xen-libs-4.1.0-1.fc15.i686 /usr/bin/qemu-img is needed by xen-runtime-4.1.0-1.fc15.i686 /usr/bin/qemu-nbd is needed by xen-runtime-4.1.0-1.fc15.i686 libSDL-1.2.so.0 is needed by xen-runtime-4.1.0-1.fc15.i686
The downside of installing everything manually is that now you have to go hunting for the packages. Thankfully, it’s not dependency hell – everything is fairly simple to get. Using Koji, grab PyXML, SDL, bridge-utils, xz-libs from xz and qemu-common and qemu-img from qemu. Then, install everything:
[root@caesium ~]# rpm -Uvh qemu-*.rpm Preparing... ########################################### [100%] 1:qemu-img ########################################### [ 50%] 2:qemu-common ########################################### [100%] [root@caesium ~]# rpm -ivh bridge-utils-1.2-10.fc15.i686.rpm Preparing... ########################################### [100%] 1:bridge-utils ########################################### [100%] [root@caesium ~]# rpm -ivh PyXML-0.8.4-26.fc15.i686.rpm Preparing... ########################################### [100%] 1:PyXML ########################################### [100%] [root@caesium ~]# rpm -ivh SDL-1.2.14-11.fc15.i686.rpm Preparing... ########################################### [100%] 1:SDL ########################################### [100%] [root@caesium ~]# rpm -ivh xz-libs-5.0.1-2.fc15.i686.rpm Preparing... ########################################### [100%] 1:xz-libs ########################################### [100%] [root@caesium ~]# rpm -ivh xen-*.rpm Preparing... ########################################### [100%] 1:xen-licenses ########################################### [ 17%] 2:xen-libs ########################################### [ 33%] 3:xen-hypervisor ########################################### [ 50%] 4:xen-doc ########################################### [ 67%] 5:xen-runtime ########################################### [ 83%] 6:xen ########################################### [100%]
Compiling Xen from source
First of all, you have to get the Xen source. You have two options for this, which we’ll deal with in a bit.
Whichever you choose, to actually build from source, you’ll need to download the compilers and such. To do so, run
yum groupinstall "Development Libraries" "Development Tools" yum install transfig wget texi2html libaio-devel dev86 glibc-devel e2fsprogs-devel gitk mkinitrd iasl xz-devel bzip2-devel pciutils-libs pciutils-devel SDL-devel libX11-devel gtk2-devel bridge-utils PyXML qemu-common qemu-img mercurial libidn-devel glibc-devel.i686
It’ll take some time, since there’s ~200MB to download, not including the time to extract, install & configure everything. But, once yum’s got everything installed, you can compile Xen from the source code.
Compiling Xen from source RPM
Your first option is simply downloading the Xen source RPM. Remember the prebuilt Xen RPMs from the automated Fedora package builder, Koji? Grab the Xen src RPM from the same place. Install the rpm with
rpm -i xen.src.rpm
This creates a directory called rpmbuild in the folder you’re working in. Switch to that working folder, and then tell rpmbuild to use the Xen specifications (in the folder SPECS) to generate rpms for install:
# cd rpmbuild/SPECS # rpmbuild -bb xen.spec
Be prepared for a bunch of status messages to scroll across your screen. This is normal.
After a while when the build process finishes you should see output like:
Wrote: /root/rpmbuild/RPMS/i686/xen-4.1.0-1.fc14.i686.rpm Wrote: /root/rpmbuild/RPMS/i686/xen-libs-4.1.0-1.fc14.i686.rpm Wrote: /root/rpmbuild/RPMS/i686/xen-runtime-4.1.0-1.fc14.i686.rpm Wrote: /root/rpmbuild/RPMS/i686/xen-hypervisor-4.1.0-1.fc14.i686.rpm Wrote: /root/rpmbuild/RPMS/i686/xen-doc-4.1.0-1.fc14.i686.rpm Wrote: /root/rpmbuild/RPMS/i686/xen-devel-4.1.0-1.fc14.i686.rpm Wrote: /root/rpmbuild/RPMS/i686/xen-licenses-4.1.0-1.fc14.i686.rpm Wrote: /root/rpmbuild/RPMS/i686/xen-debuginfo-4.1.0-1.fc14.i686.rpm
So, simply install the newly built rpms:
[root@caesium rpmbuild]# cd RPMS/i686/ [root@caesium i686]# rpm -ivh xen*.rpm Preparing... ########################################### [100%] 1:xen-licenses ########################################### [ 13%] 2:xen-hypervisor ########################################### [ 25%] 3:xen-doc ########################################### [ 38%] 4:xen-debuginfo ########################################### [ 50%] 5:xen-libs ########################################### [ 63%] 6:xen-runtime ########################################### [ 75%] 7:xen-devel ########################################### [ 88%] 8:xen ########################################### [100%]
Compiling Xen from the Xen repo
The second option is getting the latest and greatest source straight from the Xen code repos. The Xen 4.0 wiki page has more info on building from source.
Select the appropriate repository from the list of Xen repositories. In practice, you’ll probably want the latest stable branch, though you can choose the development branch or any of the historical branches. At this moment, the latest stable branch is 4.1, so that’ll be used.
Xen uses Mercurial for source control. So the command to pull the latest revision is simply
hg clone http://xenbits.xen.org/<repo name>
For the 4.1 stable branch, the command is
hg clone http://xenbits.xen.org/xen-4.1-testing.hg
And wait for the download to finish. It’ll create a folder named after the repository name, so change to the directory
cd xen-4.1-testing.hg
Then, to compile Xen, run
make xen && make tools && make stubdom
And watch your screen fill with status messages. Do note that this step requires Internet access to pull the latest source code from repositories like xen-tools. If you don’t have Internet access, this will fail.
Finally, do
make install xen && make install tools PYTHON_PREFIX_ARG= && make install stubdom
to actually install Xen.
Checking that Xen’s actually installed
A quick and simple check is to see if the folder /etc/xen
exists, and /boot
has files like xen.gz
. If it does, Xen has likely been installed correctly.