slackware64: Installing qemu-kvm and virt-manager

I've been using VirtualBox for a while on my slackware box. It's been working ok but I recently read a couple of blogs/articles recommending KVM. They said that KVM is rapidly becoming the de facto standard for open source visualization. Interesting. So, I gave a shot with qemu-kvm with libvirt (for GUI).

Disclaimer:
The information below is the result of my researches in the Internet and of my experiences. It is solely used for my purpose and may not be suitable for others.

Terminology:

libvirt
libvirt allows management of different virtualization solutions such as KVM and Xen through a common (programming and user) interface.
virt-manager
A graphical virtual machine manager
KVM (Kernel Virtual Machine)
KVM provides full virtualisation and can run unmodified Linux or Windows images, but it requires CPU virtualisation extensions (Intel VT or AMD-V).
Qemu
Qemu functioning as a userspace, software-only emulation package. It can be used standalone (that is, it does not require a special kernel module, or CPU virtualisation extensions, or a hypervisor layer) and is capable of running unmodified operating system images.

Prerequisite:

The CPU needs to support virtualization in order to take advantage of qemu-kvm. To check, execute below command: $ egrep -c '(vmx|svm)' /proc/cpuinfo

If the CPU supports virtualization, you should get a non-zero value.

Or, as Daniel Berrange suggested, virt-host-validate to validate host virtualization setup: # virt-host-validate qemu QEMU: Checking for hardware virtualization: PASS QEMU: Checking for device /dev/kvm : PASS QEMU: Checking for device /dev/whost-net : PASS QEMU: Checking for device /dev/net/tun : PASS

Installation and Post-Configurations:

Install qemu-kvm, libvirt, virt-manager and their dependencies from SlackBuilds.org.

There are a few notes for post-configuration:

  • Configure libvirt for user group and permission:
    Create a group called libvirt and assign a regular user to it. Then, uncomment unix_sock_group and unix_sock_rw_perms from /etc/libvirt/libvirtd.conf # groupadd libvirt # gpasswd -a USER libvirt # vim /etc/libvirt/libvirt.conf ----------------------------------------- unix_sock_group = "libvirt" unix_sock_ro_perms = "0770" unix_sock_rw_perms = "0770"
  • Default user group for kvm:
    The qemu-kvm SlackBuild patches the installed udev rules so that you no longer are required to use the system group kvm as the default. The users group is set as the default
  • Start the libvirt daemon at boot:
    To start the ibvirt daemon at boot, add a following piece of code to /etc/rc.d/rc.local # vim /etc/rc.d/rc.local ---------------------------------------- # Start libvirt: if [ -x /etc/rc.d/rc.libvirt ]; then /etc/rc.d/rc.libvirt start fi

Now Virtual Machine Manager (VMM) can be executed via: $ virt-manager

That's all!
-gibb

4 comments

  1. Daniel Berrange

    FYI, instead of grepping /proc/cpuinfo, you can now just run ‘virt-host-validate qemu’ as root and it’ll do some sanity checks on KVM capabilities we recommend. For example of my laptop lacking KVM support it prints

    $ virt-host-validate qemu
    QEMU: Checking for hardware virtualization : WARN (Only emulated CPUs are available, performance will be significantly limited)
    QEMU: Checking for device /dev/vhost-net : WARN (Load the ‘vhost_net’ module to improve performance of virtio networking)
    QEMU: Checking for device /dev/net/tun : PASS

  2. mindmachine

    Hi there would you mind letting me know which web host you’re using?
    I’ve loaded your blog in 3 completely different browsers and
    I must say this blog loads a lot faster then most.
    Can you suggest a good hosting provider at a honest price?
    Thanks a lot, I appreciate it!

  3. Ralph

    In what order did you build the thing? There’s so much dependencies. And did you change any flags when building qemu or spice?

Leave a Reply to Ralph Cancel reply

You may use the following HTML:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>