How to Setup and Use KVM: Part 3

This is the third part of a series on KVM. If you have not already read them, you should begin with part 1 and continue with part 2.

Once you have KVM installed, you should make sure that you have libvirt installed as well. If not, install it now.

# yum install libvirt

Next, restart the libvirt service to get KVM running.

# service libvirtd restart

Now verify that the kvm module is loaded:

$ lsmod | grep kvm

The output will look something like this:

kvm_intel 41253 0

kvm 231774 1 kvm_intel

To give a local user the ability to run a virtual machine, you will need to add the user to the kvm group. For example, to add the user “dss”:

# usermod -a -G kvm dss

If you are logged in as this user, log out to allow the new settings to take effect. When you log back in, you can verify the group inclusion with:

$ id

You will then need to repeat this step for the libvirt group.

Next, verify that your user “dss” can access qemu:

$ virsh -c qemu:///system sysinfo

Finally, change the permissions of the default images directories:

$ sudo chown root:libvirt /var/lib/libvirt/images

$ sudo chmod g+rw /var/lib/libvirt/images

In part 4 of this series, you learn how to setup a virtual machine and use it in your server environment.