Install KVM on CentOS

How to install KVM virtualization technologie on CentOS 5.4. This Howto explains step by step how to install KVM and how to create a VirtualMachine using Virtual Manager GUI.

Before you install KVM you need to verify that your CPU is compatible.

One of the following keywords needs to be in your /proc/cpuinfo: SVM (AMD) or VMX (INTEL)

Just grep /proc/cpuinfo for these keywords:

egrep 'vmx|svm' /proc/cpuinfo

If everything is right we need to install KVM:

yum install kvm

This will install a few packages.

For better console management tools install qemu:

yum install qemu

And if you want to use VirtualManager as GUI-Interface:

yum install virt-manager

Now reboot your system:

reboot

After reboot you need to load the kernel module for your processor:

AMD:

modprobe kvm-amd

INTEL:

modprobe kvm-intel

Start the libvirtd service:

service libvirtd start

and add libvirtd service to your default runlevels:

chkconfig --add libvirtd

add your user to kvm group:

usermod -G kvm -a <username>

start Virtual Machine Manager via menu or run:

virt-manager

maybe you need to enter your root password.

This windows should appear.

Now select your host and right click on it.

Select new and a wizzard will appear.

Follow the instructions and create your new virtual machine.

Choose your architecture and hypervisor.

Now select installation media.

Create a new harddisc image.

Create a new harddisc image.

Memory options for your virtual machine. For virtual CentOS installation 512MB is o.k.

Review the values and click Finish.

The image will be created and machine will be started in a new window.

Now you can install the OS. The Virtual Machine Manager window shows you all information about your running VM’s.

Here are some more information about KVM and CentOS.

If you want to use the virtual machine in the same network your host is working you need to setup a bridge device.

 

This work, unless otherwise expressly stated, is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.

2 thoughts on “Install KVM on CentOS

  1. Pingback: Banym's Blog - Some experiences with KVM

  2. remco

    Hi Banym,

    Nice tut! i get the follow error if i run the command virt-manager on the console:

    [root@vps ~]# virt-manager
    Traceback (most recent call last):
    File “/usr/share/virt-manager/virt-manager.py”, line 376, in ?
    _show_startup_error(str(run_e), “”.join(traceback.format_exc()))
    File “/usr/share/virt-manager/virt-manager.py”, line 52, in _show_startup_error
    import gtk
    File “/usr/lib64/python2.4/site-packages/gtk-2.0/gtk/__init__.py”, line 76, in ?
    _init()
    File “/usr/lib64/python2.4/site-packages/gtk-2.0/gtk/__init__.py”, line 64, in _init
    _gtk.init_check()
    RuntimeError: could not open display

    Do you have a idea how to solve this error?

    Thanks a lot.

    remco

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>