Changes

Jump to: navigation, search

Installing and Configuring Fedora Xen Virtualization

5,849 bytes added, 19:03, 28 August 2007
New page: Virtualization is the ability to run multiple operating systems on top of an existing operating system. For example, imagine booting your Fedora Linux system and, from within that Fedora s...
Virtualization is the ability to run multiple operating systems on top of an existing operating system. For example, imagine booting your Fedora Linux system and, from within that Fedora system, launching another Linux operating system (such as another Fedora Linux instance, or an Ubuntu Linux session). In this situation, your original Fedora Linux session is known as the ''host'' operating system and any other operating systems you run using virtualization are referred to as ''guest'' operating systems.

Virtualization has come to prominence in recent years because it provides a way to fully utilize CPU 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 have to re-partition the disk and reboot from Fedora Linux. You simply start up 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. Much of these improvements appeared in Fedora 7. For this reason, this chapter will focus on Virtualization in Fedora and will assume you are using Fedora 7 or later.

== 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 systems. As a guideline, a command line version of Fedora Linux requires approximately 600Mb of disk space. A full, installation of Fedora (including desktop) requires around 3Gb of disk space.

Of further concern is physical memory. Sufficient memory is required to run both the host operating system and the guest operating system. 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 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:

<pre>
grep pae /proc/cpuinfo
</pre>

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:

<pre>
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
</pre>

To support full hardware virtualization the CPU must include Intel-VT or AND-V support. This can be verified using the following commands:

For Intel CPUs:

<pre>
grep vmx /proc/cpuinfo
</pre>

For AMD CPUSs:

<pre>
grep svm /proc/cpuinfo
</pre>

If your system does not include this support you can still use Xen in para-virtualization mode.

== 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 use 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:

<pre>
su -
yum groupinstall 'Virtualization'
</pre>

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. During the boot phase you will notice some different messages appearing from previous boots. This is a good sign that the kernel with Xen support is loading.

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:

<pre>
uname -r
</pre>

You should expect to see output similar to the following:

<pre>
2.6.20-2931.fc7xen
</pre>

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

<pre>
su -
/sbin/xm list
</pre>

This command will list any Xen machines

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

<pre>
[root@fedora7 ~]# /usr/sbin/xm list
Name ID Mem VCPUs State Time(s)
Domain-0 0 384 1 r----- 1710.0
</pre>

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

== 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:

[[Image:xen_virt-manager-main.jpg|The Xen Virtual Machine Manager Main Screen]]

To create a new guest system, click on the ''New'' button to display the first configuration screen.

Navigation menu