Installing and Configuring Fedora Xen Virtualization

From Techotopia
Jump to: navigation, search
PreviousTable of ContentsNext
Sending and Receiving GMail Email on a Linux SystemManaging and Monitoring Fedora based Xen Guest Systems

Purchase and download the fully updated Fedora 13 PDF and ePub versions of this eBook for only $9.99
PDF/ePub editions contain 40 chapters and over 255 pages.

Virtualization is the ability to run multiple operating systems simultaneously on a single computer system.

Virtualization has come to prominence in recent years because it provides a way to fully utilize CPU and resource capacity of a server system whilst providing stability (in that if one virtualized guest system crashes, the host and any other guest systems continue to run).

Virtualization is also useful in terms of trying out different operating systems without having to configure dual boot environments. For example, you can try out Ubuntu Linux without having to re-partition the disk, shut down Fedora Linux and then boot from Ubuntu Linux. You simply start up a virtualized version of Ubuntu as a guest operating system.

There are a number of ways to implement virtualization on Fedora. Options include VMware and KVM. One of the most popular technologies on Fedora is called Xen. Red Hat engineers have invested considerable effort into making Xen easy to install, configure and manage on both Red Hat Enterprise Linux and Fedora. Many of these improvements appeared in Fedora 7. For these reasons, this chapter will focus on Xen Virtualization in Fedora and will assume you are using Fedora 7 or Fedora 8.

Unfortunately, support for running Xen based virtualization on Fedora releases 9, 10 and 11 is not supported. Whilst it is possible to run these versions of Fedora inside Xen virtual machines (as a domU), these newer Fedora releases cannot be used to host Xen based virtual machines (dom0). It is hoped that this support will return with the introduction Xen 3.4 in Fedora 12. If you are using one of these versions of Fedora we recommend using KVM virtualization as outlined in the chapter entitled Installing and Configuring Fedora KVM Virtualization.

For a complete online book dedicated to Xen based virtualization we recommend Xen Virtualization Essentials.

Full Virtualization vs. Para-Virtualization

There are two common approaches to virtualization - full virtualization and para-virtualization. Full virtualization provides complete abstraction between the hardware and the guest operating system. In this scenario, the guest operating system is provided a complete virtual physical environment in which to run and, as such, is unaware that it is running inside a virtual machine. One advantage of full virtualization is that the operating system does not need to be modified in order to run in a virtualized environment. This means that proprietary operating systems such as Windows can be run on Linux systems.

Disadvantages of full virtualization are that performance is slightly reduced as compared to para-virtualization, and some virtualization platforms, such as Xen, require CPUs with special virtualization support built in (such as Intel-VT and AMD-V).

Para-virtualization requires that a guest operating system be modified to support virtualization. This typically means that guest operating systems are limited to open source systems such as Linux. It is also not possible to migrate a running guest OS from one server to another. The advantage to this approach, however, is that a para-virtualized guest system comes closer to native performance than a fully virtualized guest, and the latest virtualization CPU support is not needed.

For a more detailed explanation of virtualization techniques read An Overview of Virtualization Techniques.

Checking Xen Hardware Compatibility

Before using Xen, it is important to ensure that your current hardware configuration is suitable to support Xen.

Each guest operating system installed will reside on the existing filesystems of the host Fedora system. It is important, therefore, that there is enough disk space available to install your choice of guest operating system. As a guideline, a command line version of Fedora Linux requires approximately 600Mb of disk space. A full installation of Fedora (including graphical desktop) requires around 4GB of disk space.

Of further concern is physical memory. Sufficient memory is required to run both the host operating system and the guest operating systems. If the guest operating system is not using a desktop environment, then it is possible to allocate 256Mb of memory to the guest OS. A full, graphical desktop Linux installation will require considerably more (a minimum of between 300 - 400Mb will provide reasonable, but not spectacular, performance).

In order to support virtualization, the CPU must, at a minimum, support the PAE extension. To verify that your CPU supports PAE run the following command from a Terminal window:

grep pae /proc/cpuinfo

If no output is displayed, then your CPU is not able to support Xen virtualization. If, on the other hand, you see output similar to the following, then you can proceed with the Xen configuration:

flags           : fpu tsc msr pae mce cx8 apic mtrr mca cmov pat pse36 clflush dts acpi 
                     mmx fxsr sse sse2 ss nx constant_tsc up pni ds_cpl

As mentioned previously, in order to support full hardware virtualization, the CPU must include Intel-VT or AMD-V support. This can be verified using the following commands:

For Intel CPUs:

grep vmx /proc/cpuinfo


grep svm /proc/cpuinfo

If your system does not include this support you can still use Xen in para-virtualization mode. You will not, however, be able to run Microsoft Windows as a guest operating system.

Preparing Fedora for Xen Virtualization

Xen requires a specially modified Linux kernel and a number of tools in order to operate. By default, Fedora does not install this Kernel or these tools. The next step, therefore, is to prepare the operating system for Xen. Begin by installing the virtualization tools and kernel as follows:

su -
yum groupinstall 'Virtualization'

This command will install all the required packages, and configure the boot loader to provide a Xen virtualization option when the system is next booted.

At this point, reboot the system. When the boot screen appears hit any key to enter to boot menu and select the Fedora Xen boot option. If a Xen boot option is not provided, boot using the standard Linux kernel and execute the following commands before rebooting once again:

su -
yum install xen

When the boot has completed, log in as usual and open a Terminal window. In that window run the following command to verify that kernel with Xen support has loaded:

uname -r

You should expect to see output similar to the following:


You can also check that Xen is running with the following command:

su -
/sbin/xm list

This command will list any currently running Xen machines.

It is now time to build a Xen virtual machine to contain a guest operating system:

Name                                      ID   Mem VCPUs      State   Time(s)
Domain-0                                   0   384     1     r-----   1710.0

Currently, this command lists only the host operating system. When guest operating systems are running, these too will be listed.

It is now time to build a Xen virtual machine to contain a guest operating system.

Building a Fedora Xen Guest System

Guest systems can easily be configured using either the virt-install command-line tool, or the virt-manager GUI tool. For the purposes of this chapter we will use the virt-manager tool.

Begin by launching virt-manager either by selecting the Applications->System Tools->Virtual Machine Manager or from the command-line by running /usr/sbin/virt-manager. Once loaded, the virtual manager will display the following screen:

The Xen Virtual Machine Manager Main Screen

To create a new guest system, click on the New button to display the first configuration screen. Click the Forward button to proceed to the Naming screen and enter a name for the virtual machine. This can be any name you choose.

On the next page, you can choose to configure a Full or Para-virtualized method. The Full virtualization option will only be selectable if your hardware supports it:

Xen choose virtualization method.jpg

Select Para-virtualized and press Forward. The next screen requires information about the location of the operating system installation files. Currently guest operating systems can only be installed over a network or the internet. The easiest way is to provide the http address of the operating system installation files. To install the i386 Fedora 7 distribution you might, for example, enter:

Alternatively, select a mirror site closest to your geographical location from the Fedora mirror list.

Once an appropriate address has been entered, click the next button to assign storage space:

Assigning Storage Space for a Xen Guest System

If you have a disk partition available for the guest operating system, enter the device path. Otherwise, select Simple file and enter the path of the file to be created and select a file size (keeping in mind the space requirements for your chosen guest OS). Click the Forward key once more.

On the Connect to network host select Shared physical device and click Forward. This will configure the guest OS to share the host operating system's network connection.

The next screen allows configuration of memory and CPU usage:

Xen memory cpu.jpg

Select a memory setting which allows sufficient memory for the host system and the guest system to co-exist. If you plan to run multiple guest operating systems, be sure to allow for this.

On a multi-CPU or multi-core CPU environment it is possible to define how many CPUs the guest OS will have access to. The final screen displays a summary of the configuration:

Xen summary.jpg

Click on the Finish button to begin the creation process. The virtualization manager will create the disk and configure Xen before starting the system. Once started, the guest OS installation will begin:

Fedora xen os install.jpg

From this point on, simply follow the operating installation instructions to install the guest OS.

The next chapter will focus on Managing and Monitoring Fedora based Xen Guest Systems.

Purchase and download the fully updated Fedora 13 PDF and ePub versions of this eBook for only $9.99
PDF/ePub editions contain 40 chapters and over 255 pages.