Difference between revisions of "Installing KVM Virtualization on RHEL 5"

From Techotopia
Jump to: navigation, search
m (Text replacement - "<google>BUY_RHEL5</google>" to "<htmlet>rhel5</htmlet>")
m (Text replacement - "<google>BUY_RHEL5_BOTTOM</google>" to "<htmlet>rhel5</htmlet>")
Line 132: Line 132:
 
In theory the system is now ready to create virtual machines into which guest operating systems may be installed and run. Before taking that step, it is worth spending some time in the next chapter talking about virtual networks and network bridges.
 
In theory the system is now ready to create virtual machines into which guest operating systems may be installed and run. Before taking that step, it is worth spending some time in the next chapter talking about virtual networks and network bridges.
  
<google>BUY_RHEL5_BOTTOM</google>
+
<htmlet>rhel5</htmlet>
  
 
<hr>
 
<hr>

Revision as of 21:37, 1 February 2016

PreviousTable of ContentsNext
Managing Xen on RHEL 5 using the xm and virsh Command-line ToolsCreating an RHEL 5 KVM Networked Bridge Interface


You are reading a sample chapter from the RHEL 5 Edition book.

Purchase the fully updated Red Hat Enterprise Linux 8 (RHEL 8) Edition of this publication in eBook ($9.99) or Print ($36.99) format

Red Hat Enterprise Linux 8 Essentials Print and eBook (ePub/PDF/Kindle) editions contain 31 chapters and over 250 pages

Buy Print Preview Book


As discussed in previous chapters of this book, virtualization is the ability to run multiple operating systems simultaneously on a single computer system, and a number of different commercial and open source solutions are available. In the preceding chapters we looked in detail at configuring and maintaining Xen based virtualization on Red Hat Enterprise Linux 5. In this and subsequent chapters we will look at KVM based virtualization hosted on an RHEL system.


Contents


KVM Hardware Requirements

Before proceeding with this chapter we need to take a moment to discuss the hardware requirements for running virtual machines within a KVM environment. Firstly, KVM virtualization is only available on certain processor types. These processors include either Intel-VT or AMD-V technology.

To check for Intel-VT support, run the following command in a terminal window to check for the presence of vmx:

# grep vmx /proc/cpuinfo 
flags : fpu tsc msr pae mce cx8 apic mtrr mca cmov pat pse36 clflush dts 
acpi mmx fxsr sse sse2 ss ht tm syscall nx lm constant_tsc pni monitor 
ds_cpl vmx est tm2 cx16 xtpr lahf_lm

To check for AMD-V support, run the following command which checks for the presence of svm:

# grep svm /proc/cpuinfo
flags           : fpu tsc msr pae mce cx8 apic mtrr mca cmov pat pse36 clflush mmx 
fxsr sse sse2 ht syscall nx mmxext fxsr_opt rdtscp lm 3dnowext 3dnow pni cx16 
lahf_lm cmp_legacy svm cr8_legacy

Note that while the above commands only report whether the processor supports the respective feature, it does not indicate whether the feature is currently enabled in the BIOS. In practice virtualization support is typically disabled in the BIOS of most systems. It is recommended, therefore, that you check your BIOS settings to ensure the appropriate virtualization technology is enabled before proceeding with this tutorial.

If your processor does not have Intel-VT or AMD-V support you will still be able to install guest operating systems though this will be implemented using the QEMU environment instead of KVM virtualization. QEMU uses emulation to run guest operating systems and as such results in slower performance than the hardware assisted virtualization offered by KVM.

Unlike a dual booting environment a virtualized environment involves the running of two or more complete operating systems concurrently on a single computer system. This means that the system must have enough physical memory, disk space and CPU processing power to comfortably accommodate all these systems in parallel. Before beginning the configuration and installation process check on the minimum system requirements for both RHEL and your chosen guest operating systems and verify that your system has sufficient resources to handle the requirements of both systems.

32-bit Support for KVM on RHEL 5

Whilst previous versions of RHEL supported KVM on both 32-bit and 64-bit systems, as of RHEL 5.4 support for KVM virtualization is only available for 64-bit (x86_64 architecture) versions of the operating system.


Adding the Red Hat Enterprise Linux 5 Virtualization Channel to the System

By default, the Virtualization channel is not configured into the Red Hat Network subscription for RHEL 5 systems. If not previously added to your RHEL subscription, this channel must first be enabled before the KVM tools may be installed. To do so, log into http://rhn.redhat.com and locate the system for which the Virtualization channel is to be enabled. Once located, display the system’s overview page as illustrated in the following figure:


RHN system overview screen


Under the Subscribed Channels heading check to see if the virtualization channel is enabled. If it is not currently enabled, click on the Alter Channel Subscriptions link and check the box next to RHEL Virtualization listed under Channel Entitlements:


Adding the virtualization channel to an RHEL 5 RHN subscription


Once the channel has been selected, click on the Change Subscriptions button in the lower right hand corner of the web page. On returning to the system overview page, the RHEL Virtualization channel will now be listed under the subscribed channels.

On the RHEL system, open a terminal window, su to root and execute the following command:

# rhn_check

This will force the system to update with the latest channel information.

Preparing RHEL for KVM Virtualization

Unlike Xen, it is not necessary to run a special version of the kernel in order to support KVM. As a result KVM support is already available for use with the standard kernel via the installation of a KVM kernel module, thereby negating the need to install and boot from a special kernel.

To avoid conflicts, however, if a Xen enabled kernel is currently running on the system, reboot the system and select a non-Xen kernel from the boot menu before proceeding with the remainder of this chapter.

The tools required to setup and maintain a KVM based virtualized system are not installed by default unless specifically selected during the RHEL operating system installation process. To install KVM from the command prompt, execute the following command in a terminal window with root privileges:

yum install kvm virt-manager

Alternatively, launch the Package Manager by selecting the Applications -> Add/Remove Software menu from the desktop menu system. Enter the root password if prompted to do so and scroll down the list of categories, selecting Virtualization when it becomes visible.

In the right hand column make sure that Virtualization is not selected. If it is selected, deselect it and click on the Apply button. Once these packages have been removed, select KVM and click on Apply once again to install the KVM package and any additional dependencies. If the installation fails with a message similar to the following then it is likely that you are attempting to install KVM on a 32-bit system, or a 64-bit system running a 32-bit version of RHEL 5:

Error: libvirt conflicts with kvm

Once the installation of KVM is complete, close any applications that are running and reboot the system.

Verifying the KVM Installation

Once the system has restarted after the reboot it is worthwhile checking that the installation worked correctly before moving forward. When KVM is installed and running two modules will have been loaded into the kernel. The presence or otherwise of these modules can be verified in a terminal window by running the following command:

su -
lsmod | grep kvm 

Assuming that the installation was successful the above command should generate output similar to the following:

lsmod | grep kvm
kvm_intel              86920  1
kvm                   226208  2 ksm,kvm_intel

Note that if the system contains an AMD processor the kvm module will likely read kvm_amd rather than kvm_intel. The installation process should also have configured the libvirtd daemon to run in the background. Once again using a terminal window with super user privileges, run the following command to ensure libvirtd is running:

/sbin/service libvirtd status
libvirtd (pid  2958) is running...

If the process is not running, it may be started as follows:

/sbin/service libvirtd start

Finally, run the virt-manager tool by selecting the Applications -> System Tools -> Virtual Machine Manager menu. When loaded, the manager should appear as illustrated in the following figure:

If Xen virtualization was previously installed on the system, an error message may appear stating that virt-manager is “unable to open a connection to Xen hypervisor/daemon”. If this occurs, dismiss the error dialog, select the xen entry from the main virt-manager screen and click on the Delete button to remove it from the database.

If, on the other hand, the QEMU entry is not listed, select the File -> Add Connection menu option and in the resulting dialog select the QEMU hypervisor before clicking on the Connect button:

If the manager is not currently connected to the virtualization processes, right click on the entry listed and select Connect from the popup menu.

In theory the system is now ready to create virtual machines into which guest operating systems may be installed and run. Before taking that step, it is worth spending some time in the next chapter talking about virtual networks and network bridges.

You are reading a sample chapter from the RHEL 5 Edition book.

Purchase the fully updated Red Hat Enterprise Linux 8 (RHEL 8) Edition of this publication in eBook ($9.99) or Print ($36.99) format

Red Hat Enterprise Linux 8 Essentials Print and eBook (ePub/PDF/Kindle) editions contain 31 chapters and over 250 pages

Buy Print Preview Book


PreviousTable of ContentsNext
Managing Xen on RHEL 5 using the xm and virsh Command-line ToolsCreating an RHEL 5 KVM Networked Bridge Interface