CentOS / Redhat: Install KVM Virtualization Software

KVM (Kernel-based Virtual Machine) is a full virtualization solution for Linux on x86 hardware containing virtualization extensions Intel VT or AMD-V. How do I install KVM under CentOS or Red Hat Enterprise Linux version 5.5? The Linux kernel 2.6.20 and above included KVM. RHEL 5.5 (and upcoming RHEL 6) supports KVM out of box and it has also been ported to FreeBSD as a loadable kernel module. However, this tutorial is tested on both CentOS and RHEL 5.5 only running 64 bit Intel Xeon CPU (with Intel VT) and 64 bit kernels with SELinux running in enforcing mode.

Why KVM?

XEN allows several guest operating systems to execute on the same computer hardware and it is also included with RHEL 5.5. But, why use KVM over XEN? KVM is part of the official Linux kernel and fully supported by both Novell and Redhat. Xen boots from GRUB and loads a modified host operating system such as RHEL into the dom0 (host domain). KVM do not have concept of dom0 and domU. It uses /dev/kvm interface to setup the guest operating systems and provides required drivers. See the official wiki for more information.

A Note About libvirt

libvirt is an open source API and management tool for managing platform virtualization. It is used to manage Linux KVM and Xen virtual machines through graphical interfaces such as Virtual Machine Manager and higher level tools such as oVirt. See the official website for more information.

A Note About QEMU

QEMU is a processor emulator that relies on dynamic binary translation to achieve a reasonable speed while being easy to port on new host CPU architectures. When used as a virtualizer, QEMU achieves near native performances by executing the guest code directly on the host CPU. QEMU supports virtualization when executing under the Xen hypervisor or using the KVM kernel module in Linux. When using KVM, QEMU can virtualize x86, server and embedded PowerPC, and S390 guests. See the official website for more information.

A Note About Virtio Drivers

Virtio is paravirtualized drivers for kvm/Linux. With this you can can run multiple virtual machines running unmodified Linux or Windows VMs. Each virtual machine has private virtualized hardware a network card, disk, graphics adapter, etc. According to Redhat:

Para-virtualized drivers enhance the performance of fully virtualized guests. With the para-virtualized drivers guest I/O latency decreases and throughput increases to near bare-metal levels. It is recommended to use the para-virtualized drivers for fully virtualized guests running I/O heavy tasks and applications.

Host Operating System

Your main operating system such as CentOS or RHEL is known as host operating system. KVM is a Linux kernel module that enables a modified QEMU program to use hardware virtualization. You only need to install KVM under host operating systems.

KVM Domains

It is nothing but a guest operating system running under host operating system. Each kvm domain must have a unique name and ID (assigned by system).

TCP/UDP Ports

By default libvirt does not opens any TCP or UDP ports. However, you can configure the same by editing the /etc/libvirt/libvirtd.conf file. Also, VNC is configured to listen on 127.0.0.1 by default. To make it listen on all public interfaces, edit /etc/libvirt/qemu.conf file.

Which gives better results with non-virtual aware operating system, xen or kvm. I can never remember. I am considering trying to run Windows 7 within a xen or kvm instance on Centos 5.5. Does anyone know if it supports Directx? A couple of the games I play use it for 3d and effects rendering.

as far as I’m aware Novell does not yet support KVM, it is included in SLES11 sp1 as a “technology preview”, I think they call it, ie they include it for you to test but it is not supported, at least not officially.

Running a 64 bit kernel (RHEL 64 bit) on the host operating system is recommended but not required. You can use 32bit but limited to 2GB ram per VM. A 32 bit server can only host 32-bit guest operating system.

Hi all could anyone advise me to solve the problem the problem is as following: I’ve installed kvm with all its packages and when i want to install win 7 it will be stacked and does not go forward please help i’ll be appreciated

For the host Centos OS, what is the recommended installation configurations? (Server or Minimal)? I have chosen Minimal but couldn’t load any GUI for my centos…and is stuck at the step where it is suppose to load a GUI for virtual manager

same thing from my side also….For the host Centos OS, what is the recommended installation configurations? (Server or Minimal)? I have chosen Minimal but couldn’t load any GUI for my centos…and is stuck at the step where it is suppose to load a GUI for virtual manager.

first thank you Vivek, for writing an article that brand new newbies could follow, nice organized. Further request to dumb it down by some server sizing how many CPUs, RAM etc especially for small cluster of 1-10 desktops (that is what we like to do)… also do you have articles on how to installed RHEL 64 on a brand new machine?

Sorry folks, I have to start somewhere, I am staring at my RHEL 6.2 ISO images, new server no OS on it, 3.0 GHz CPU quad core and 16 GB RAM. Plugged in and I have no CLUE. I absolutely cannot stand the other techies speak nor understand it.

Everything else I read, just went into total geekdom high brow type writeup/

Vivek any dummy level article that goes step by step or any material I could read up on will be deeply appreciated!!!

I have question, I already installed kvm at dell R720 12 Core with 64GB RAM and 4TB HDD SCSI with RAID5. Problem with windows guest OS when running with KVM, ethernet using virtio driver very slow performance, I copy from sharing folder 25Mb it took 60Minutes until finish. but running well wit Linux guest OS.

In my setup we need to configure both IPV4 and IPv6 on same KVM machine(Br0 for IPV4 and Br1 for IPV6 internal). Can some one who worked on this kind of setups please suggest me how to create bridges and guest network. I have configured as i IPV4 setup but very often the guests are not reachable from outside of the server.