Difference between revisions of "Fedora Host Installation"
(→Networking for domUs)
(→Installing a domU)
|Line 90:||Line 90:|
Revision as of 14:33, 9 May 2012
This tutorial will cover the steps to get a working dom0 running on a Fedora 16 system.
Fedora 16 is the first version of Fedora that comes with a kernel that supports a Xen dom0 out of the box since Fedora 8. This is a result of dom0 support being merged into the mainline kernel. As such, there are very few steps that have to be done to get a functional dom0.
Installing Fedora 16
For the most part, you can follow the Installation steps outlined the official Fedora Installation Guide.
The only portion you have to watch out is the disk partitioning section. If you're going to use file-backed domUs, you can safely ignore this step.
However, if you're going to use LVM (or other block devices, like hard drive partitions)-backed domUs, you're probably going to partition your drive into /boot, and at least one or two volume groups, meaning that you'll be making a custom partitioning scheme. The Installation Guide recommends that you create a BIOS boot partition if you're booting on a x86/x86_64 system. However, this partition is *required*, unless you pass "nogpt" as a argument on the install option line when you first boot the installer. Keep things simple for yourself, and create the partition. 1MB is sufficient space.
At this point, you should do whatever else you have to get the basic system up and running. Example tasks would be updating the system, and installing ntpd to automatically keep your dom0's time in sync.
At a minimum, you should check that a network connection is available and functioning.
You should also disable SELinux if you're managing LVM storage manually, unless you want to relabel the created LVs. xl _will_ complain that "the disk is not accessible" if you fail to do this and you're using LVs for storage.
Getting Xen onto the system
Getting the Xen hypervisor is a simple matter - just run
yum install xen
as root. Yum will take care of downloading the dependencies and installing them for you automatically.
As part of the download, Yum will create a new grub2 boot menu. As such, don't panic if Yum seems to freeze at "Installing xen-hypervisor" for a while.
Once the installation is complete, you should reboot, and select Xen 4.x.x from the GRUB menu. (As of 27/11/2011, there's a bug that results in GRUB2 generating a number of boot entries for each Xen file that it finds in /boot. Unfortunately, it doesn't check if the file in question is a linked file, and results in generating a host of spurious entries.)
Now that Xen's installed, and you booted into it, you should check that it's working by running
from the command line.
Your screen should show something like
host : caesium release : 3.1.1-2.fc16.i686.PAE version : #1 SMP Mon Nov 14 15:57:20 UTC 2011 machine : i686 nr_cpus : 4 nr_nodes : 1 ...
If Xen's not working, you'll get something like:
libxl: error: libxl.c:56:libxl_ctx_init Is xenstore daemon running? failed to stat /var/run/xenstored.pid: No such file or directory cannot init xl context
Networking for domUs
Networking gave a lot of trouble in Xen 3/4.0. However, in Xen 4.1, the default behaviour is to let the dom0's network scripts (ie. the ones that came with the distribution, not the ones that come with Xen) handle setting up a network bridge, and the new xl script will just attach the domU's network interface to the bridge.
Unfortunately, NetworkManager currently doesn't support bridges, so we need to manually edit config files. For Red Hat-based distros, the networking configuration is stored in /etc/sysconfig/network-scripts/, so switch to that directory to make everything easier. Whether you're using the command line or GUI doesn't matter, but I'll be using the command line for the rest of this section.
By default, NetworkManager is included in the default Fedora install. But we don't want to use it, so we'll need to disable it before we continue. Do that by running
systemctl disable NetworkManager.service || systemctl restart network.service
Also, we need to make sure that the network service is kicked off automatically on subsequent restarts by running
chkconfig network on
Next, create the configuration file for the bridge.
The most common bridge name is br0, but other Xen documentation suggests using xenbr0 to make it obvious that the bridge is for Xen. I chose to keep things simple, and just use br0, and so my command was
Change this as necessary for your bridge name!
Open the file in a text editor, and paste the following lines in it:
DEVICE=br0 TYPE=Bridge BOOTPROTO=dhcp ONBOOT=yes DELAY=0 NM_CONTROLLED=NO
After that, you'll need to find the configuration file for your existing network adaptor. It's most likely named ifcfg-eth0, though the part after the dash can and does change depending on your hardware.
Once you know what config file you're using, open the file in your text editor again, and find the line
and change it to
. Next, add the line
(or whatever you named your bridge) to the file. Finally, run
systemctl restart network.service
Your network should be working, but just to be sure, run ifconfig to check. You should get something like this:
br0 Link encap:Ethernet HWaddr 00:07:E9:06:50:12 inet addr:192.168.1.122 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fe80::207:e9ff:fe06:5012/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:1858 errors:0 dropped:0 overruns:0 frame:0 TX packets:678 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:329223 (321.5 KiB) TX bytes:76663 (74.8 KiB)
Installing a domU
By this point, your system should be set up to install domUs. You can install domUs with a variety of ways.
For beginners, Fedora has libvirt in its repositories, which makes installing Red Hat based distros (like Fedora/CentOS) extremely easy. You can refer to installing a domU with virt-manager (GUI based) or installing a domU with virt-install (console based, ideal if you're working over an SSH connection)