WORK IN PROGRESS – FIRST DRAFT OF THE PAGE
This is a quick install guide for getting a Gentoo Xen host installed and configured on a clean x86 server. You’ll need to be familiar with both Gentoo and Xen in order to use the guide, it is not a guide for total noobs, sorry…
We make extensive use of Gentoo throughout our infrastructure, and Xen is a loyal virtualization technology that we cannot live without (whether on our own hardware or on Amazon’s EC2).
This guide is basically a carbon copy of the Gentoo Linux x86 Quick Install Guide and the Configuring Gentoo with Xen documents, but the steps are mixed together when it comes to installing Xen, the Xen kernel and rebuilding the world.
Phase 1 – Getting the install media, setting up partitions and getting the stage and portage on the disk
Partition layout We use a standard layout on all our servers that looks like this:
Device Boot Start End Blocks Id System /dev/sda1 1 13 104391 83 Linux /dev/sda2 14 136 987997+ 82 Linux swap / Solaris /dev/sda3 137 1353 9775552+ 83 Linux /dev/sda4 1354 13275 95763465 8e Linux LVM
We give our guest domains logical volumes to use as storage. Using LVM for Xen guest storage simplifies backups, resizing of disks and plenty else. A couple of Google’s will help you find some more valuable information (I’ll amend this page in time).
Phase 2 – Updating make.conf, rebuilding world, install Xen and the Xen kernel
The Quick Install Guide takes you through a normal Gentoo kernel install, where the Xen guide takes you through rebuilding the world and getting the Xen kernel/tools installed.
I skip the standard Gentoo kernel and jump directly into the Xen steps here.
You need to edit /etc/make.conf and add “-mno-tls-direct-seg-refs” to the CFLAGS, so it looks like this:
# nano -w /etc/make.conf
CFLAGS="-O2 -march=pentium4 -pipe -mno-tls-direct-seg-refs"</pre>
Then, before you rebuild the world, make sure your portage snapshot is fully up to date, and then rebuild the world.
# emerge --sync # emerge -evat world
Now everything is optimized for Xen, without the rebuild your Xen performance would be very very poor.
You can then continue the steps in the Configuring Gentoo with Xen up and until configuring the guest domains. You can continue that after completing the rest of the Quick Install Guide. Reason? Well, you now skip the Kernel Configuration section in the Quick Install Guide and continue with “Configuring your system“. You do need a valid fstab file, grub, and the works.
My only notes on configuring the Xen kernel is that we don’t split up the build in different locations, we are disciplined :). If you get boot errors (kernel can’t find the root file system) check for missing SCSI/SATA drivers in the kernel configuration.
Phase 3 – Enjoy Gentoo and Xen
There are plenty of resources available on the net for Gentoo and Xen, and Xen in itself. We’ve built plenty of Xen servers over the last couple of years, including Debian, CentOS and Gentoo-based hosts. The same rules apply to all of them. Keep your head on and make sure your privileged kernel has the correct drivers.