On this page

Virtualization With KVM On A CentOS 5.2 Server

Version 1.0
Author: Falko Timme

This guide explains how you can install and use KVM for creating and running virtual machines on a CentOS 5.2 server. I will show how to create image-based virtual machines and also virtual machines that use a logical volume (LVM). KVM is short for Kernel-based Virtual Machine and makes use of hardware virtualization, i.e., you need a CPU that supports hardware virtualization, e.g. Intel VT or AMD-V.

I do not issue any guarantee that this will work for you!

1 Preliminary Note

I'm using a CentOS 5.2 server with the hostname server1.example.com and the IP address 192.168.0.100 here as my KVM host.

We also need a desktop system where we install virt-manager so that we can connect to the graphical console of the virtual machines that we install. I'm using an Ubuntu 8.10 desktop here.

2 Installing KVM

CentOS 5.2 KVM Host:

Run

system-config-securitylevel

and set SELinux to Permissive (virt-install will not work if you set SELinux to Disabled).

Then check if your CPU supports hardware virtualization - if this is the case, the command

Next we need to set up a network bridge on our server so that our virtual machines can be accessed from other hosts as if they were physical systems in the network.

To do this, we install the package bridge-utils...

yum install bridge-utils

... and configure a bridge. Create the file /etc/sysconfig/network-scripts/ifcfg-br0 (please use the BOOTPROTO, BROADCAST, IPADDR, NETMASK and NETWORK values from the /etc/sysconfig/network-scripts/ifcfg-eth0 file):