Debian 7 "Wheezy" and QEMU-KVM

Hello friends!. Debian 7 ?. Plain and simple Out of Series as we say in Cuba. The International Space Mission changed Windows XP to Squeeze… because Wheezy wasn't stable yet! 🙂

I can't write about the QEMU-KVM without mentioning the Wheezy. Never before have I had the great experience of installing Debian on the desktop version in the "install and use" way. That's how easy the Wheezy is. I recommend it to everyone.

And when I say ALL, it is because I just made a virtual machine with only 256 megabytes of RAM, with the Wheezy and his desktop. If I select in the graphical login the "GNOME Classic" works very well. Of course that amount of memory does not load the GNOME Shell 3.4 + 7.

I do not want to include images about the installation of Wheezy as I prefer to discover it for yourself. Download an installation CD or DVD, install Debian 7, and use it. But nothing. They will tell me.

Those who have a good amount of memory (1 gigabyte or more) or the GNOME Shell 3.4 + 7 automatically loads, will discover part of its benefits if they direct the mouse pointer to the upper left corner. Browse through this excellent Debian Desktop as the Debianists dubbed their desktop in Wheezy.

Congratulations to that huge group that is, to the happiness of many, Debian!

For those who miss some details of GNOME (like me), we recommend installing the following packages as a minimum:

  • nautilus-emblems
  • nautilus-image-converters
  • nautilus-image-manipulators
  • nautilus-open-terminal

For those who have a processor with the virtualization extensions - in general a modern Dual Core forward - the rest of the post is essentially directed.


KVM o Kernel-based Virtual Machine, works only if the processor has the hardware virtualization extensions, both Intel © and AMD-V ©. We can determine it if we execute the following command in a console:

# egrep -c "(svm | vmx)" / proc / cpuinfo

If the command returns 0, it indicates that the processor does not support hardware virtualization. A value of 1 or higher will indicate how many processors have this characteristic. We must enable (or check if it is enabled) this function in the BIOS of our computer, even if the returned value is 1 or greater.

I don't like to make comparisons at all. Each software has its charm. I'll just say goodbye to Ctrl + Alt to free the mouse pointer; goodbye to the need for build-essential, binutils, linux-headers-'uname -r 'packages; goodbye to patches to run an old version on a new kernel; goodbye to a -sometimes tedious- installation from a perl script or another language; goodbye to a web interface for the administration and / or creation of virtual machines (which on many occasions made us suffer or simply did not work); and to all those specific questions that those of us who have previously worked with other software for virtual machines know.

QEMU-KVM is a total solution for virtual machines. The packages are in the repository on the main branch. It's the best, as my colleague and friend El Freake told me when he recommended it to me.

And here I bring you, as always, an Entry Point to the fascinating world of creating and managing servers or virtual machines using QEMU-KVM on Wheezy (also on Squeeze).

Definitions taken from Wikipedia:

QEMU is a processor emulator based on the dynamic translation of binaries (conversion of binary code from the source architecture into understandable code by the host architecture). QEMU also has capabilities virtualization within an operating system, either GNU / LinuxWindows, or any of the supported operating systems, (in fact it is the most common way of use). This virtual machine can run on any type of Microprocessor or architecture (x86x86-64PowerPCMIPSSPARC, etc.). He is licensed in part with the LGPL and LPG de GNU.

Kernel-based Virtual Machine o KVM, (in SpanishKernel-based virtual machine) is a solution to implement full virtualization with Linux. It consists of a kernel module (with the name kvm.ko) and tools in the user space, being in its entirety FOSS. The KVM component for the kernel is included in Linux since version 2.6.20.

Libvirt: Library written in C (C toolkit) to interact with the recent virtualization capabilities of modern versions of Linux (and other operating systems).

Let's get down to business!.

Install the necessary packages on a workstation:

# apt-get install qemu-kvm libvirt-bin bridge-utils virt-manager hal

We clarify that it is in a workstation because the package virt-manager It is the graphical interface or GUI for the administration of our virtual machines on our Desktop and for the rest of the servers on our LAN that we have dedicated to supporting virtual machines. Furthermore, the process of creating and managing virtual machines or servers can be performed in console mode only without the need for a graphical interface. Consult the man pages of the installed packages which are very descriptive. Much more than this article. Too bad they are in English.

The user root and the group members libvirt they are the only ones who have permissions to use the KVM virtual machines. Therefore we must make our user a member of the group libvirt:

# adduser myuser libvirt

We must close the session and enter again for the previous command to take effect.

Note on Ubuntu: I could not test the qemu-kvm with Ubuntu 12.04. I THINK that the only important difference lies in this command in which we must specify the group libvirtd. The rest MUST be valid.

After the above there is little to explain because we can run the "Virtual Machine Manager" or virt-manager, which we will find in the application group "System tools", Or we can invoke it if we press Alt + F2 and type in the dialog box virt-manager.

To create a virtual machine we click on the button "Create a new virtual machine”And we follow the steps of the wizard which is very intuitive. After reviewing the hardware of the virtual machine being created, we click on the button "Start installation”And we began to install the equipment in the usual way as if it were a physical server.

virt-manager-01 virt-manager-02 virt-manager-03 virt-manager-04 virt-manager-05 virt-manager-06 virt-manager-07 virt-manager-08 virt-manager-09 virt-manager-10

Accompanying Documentation:

  • / usr / share / doc / qemu
  • / usr / share / doc / qemu-kvm
  • / usr / share / doc / qemu-system
  • / usr / share / doc / virt-manager
  • / usr / share / doc / libvirt-bin
  • Manual pages or "Mon": Qemu-img, virsh, virt-clone, virt-convert, virt-host-validate, virt-image, virt-install, virt-manager, virt-viewer, virt-xml-validate.




Virtual Networks: By default, the Virt-Manager proposes the subnet for the NAT type virtual network and with an internal DHCP server. If by chance we delete the virtual network "default", which we do NOT recommend, and we try to create a new one and we cannot due to permission issues, we go to the folder / etc / libvirt / qemu / networks, and if we DO NOT find the file default.xml, we create it again with the following content:


As we can see, if we manually edit this file, we can declare another subnet and eliminate DHCP. It will always be better to create a new virtual network through the Virt-Manager interface, activate the Auto-start box and select it when we create a virtual machine. To prevent the "default" virtual network from starting itself, we do not select the Auto-start box.

Storage: by default it is located in / var / lib / libvirt / images. The best option is to create a new Storage using the graphical interface, and place it in the directory or place that suits us best. The configuration files are located at/ etc / libvirt / storage /.

Create hard drives with qcow2 format (qemu copy on write) before creating a virtual machine is a good option. See man qemu-img.

Backup configuration files: Always make a backup copy of the configuration files BEFORE modifying them manually.

Your Order

As we stated at the beginning of our article, the guide given is only a small introduction to the subject. It is impossible to replace in a post the extensive documentation of this powerful tool. Enjoy!.

Until the next adventure, Friends !.

The content of the article adheres to our principles of editorial ethics. To report an error click here!.

60 comments, leave yours

Leave a Comment

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



  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   elav said

    Great .. today I migrate from Virtualbox to Qemu-kvm 😀

  2.   Arangoiti said

    Do you know if the virtual machines of Qemu-kvm allow to handle the USB ports?

    Thank you.

    1.    Julius Caesar said

      If USB works over Qemu KVM

      1.    Federico Antonio Valdés Toujague said

        Greetings and Thanks my friend El Freake !!!

    2.    Arangoiti said

      Well I have installed it in Xubuntu, without problems, but compared to VirtualBox, with a Virtual machine with Windows XP it is slow.

      A greeting.

  3.   eliotime3000 said

    Fico, the version of Debian you use, is it the Squeeze or Wheezy? Because so far I don't know how the hell I make the GNOME 3 fallback look like GNOME 2.

    1.    DanielC said

      Did you install gnome-session-fallback? I've tried wheezy a long time ago and can't remember if it was installed by default along with the Shell.

      1.    Federico Antonio Valdés Toujague said

        Daniel, if you install the gnome-session-fallback package by default

    2.    Federico Antonio Valdés Toujague said

      A week ago, the Wheezy, and for over 1 year, the Squeeze. KVM works in both

  4.   Cocolio said

    Well, good article, the truth is this is the first time that I download Debian, I have always used other distros, I have already downloaded this one for days but without time to use it in a virtual machine, luckily I have 12 gigabytes on my PC so I will assign at least 1 gig or maybe more, I'll tell you how it went, greetings.

  5.   kikee said

    What a coincidence that a few days ago I returned to Qemu because VirtualBox is always giving me problems, I even use Qemu on Windows. I thought that in the post you were going to explain how Qemu works with commands, but I did not know about this interface.

    1.    eliotime3000 said

      I am more lost in Xen than in QUEMU and VirtualBox.

  6.   dhunter said

    I did not know about it, the other day I found aqemu (qt4) and I have been testing it but this solution is much more professional, thanks Federico.

    In the end it gives me an error in the NAT network, but it was because it is not activated in the kernel by default.

    But I found a solution on the forum, recompiling.

    «… Add IPv4 NAT (Networking Options -> Network Packet Filtering Framework -> IP Netfilter Configuration)»

  7.   dhunter said

    An example of the command to create the image: "qemu-img create -f qcow2 debian.img 10G"

    1.    Federico Antonio Valdés Toujague said

      Greetings Dhunter !!! With the man qemu-img you do a PhD in this regard. 🙂

  8.   elav said

    I'm already in Qemu-KVM .. to fuck Virtualbox and its fucking restrictions ..

    1.    pandev92 said

      I am very comfortable with vmware ...

      1.    elav said

        Do you really think that for my VMWare it is a better alternative than Qemu-kvm? Starting from that not only is VMWare proprietary, but with Qemu-KVM I don't need anything from third parties ... and it will always be compatible with my kernel.


        1.    pandev92 said

          I'm not saying it's a better alternative, but it runs the precompiled virtual machines, from osx, and windows 7 that I downloaded from piratebay, and that's enough for me xD ,. it also has very good performance

        2.    eliotime3000 said

          So, to install the VirtualBox OSE that is in Debian Wheezy (or compile it on your own version 4.2, since unfortunately Oracle only lets you download the official version and not the OSE).

          1.    pandev92 said

            well, in windows I used it with my amd x2 and it was going quite well, to run osx environments, it is the only one that I could the truth, I tried with virtualbox and it has never finished working for me.

          2.    eliotime3000 said

            @ pandev92:

            The same thing happens to me with the official Virtualbox in Windows, but I have not found errors when executing it in GNU / Linux.

      2.    eliotime3000 said

        VMWare is much heavier than Oracle Virtualbox because it uses your hardware resources to speed up your virtual machine. Hence why I use the VirtualBox OSE (although I prefer other alternatives such as Xen or QUEMU).

    2.    dwarf said

      Qmenu would be the UI qt for KVM? I have to start doing tests xD

    3.    Giskard said

      What restrictions do you have in VirtualBox?

      1.    elav said

        Well, if you use i386 you can't emulate amd64, with kvm I think you can. There is no USB support if you don't install an addons. In GNU / Linux the guestaddition does not put the screen to fullscreen ... anyway ..

        1.    eliotime3000 said

          When emulating amd64 on an i386 PC, the feeling is the same when using VMWare Workstation.

          As for the Guest Additions, I must say that if you put 96 MB you can make it take up the whole screen (I tried it with KDE, GNOME and others with Debian Squeeze update 6).

          Anyway, when I want to make a Debian Server (I call it like that in reference to the "Ubuntu Server" which is nothing more and nothing less than a bastardized netinstall version), I do it without a graphical interface and I immerse myself in the world of the console. that I've already gotten a particular liking for the GNU Nano and the power it gives my little finger.

  9.   Marco Lopez said

    Is this version of debian almost stable, or better is 6? 😀

    1.    Federico Antonio Valdés Toujague said

      Do not hesitate. Install and use Wheezy

      1.    eliotime3000 said

        For now, its stability is on par with Ubuntu LTS, but with the passing of its updates, it will be at the level of CentOS (If it were not for the immense number of packages, it was already being used by the International Space Station).

        As for distros like CentOS, I would rather use it as a replacement for Windows XP unless it makes it easy to install and / or update with the terminal.

  10.   ahdezzz said

    Hello, I am using Ubuntu 13.04 and I get the following error when opening the program:

    Could not connect to libvirt.

    Verify that:
    - The 'libvirt-bin' package is installed
    - The 'libvirtd' daemon has been started
    - You are a member of the 'libvirtd' group

    and when I give show details the following comes out:
    Could not connect to libvirt.

    Verify that:
    - The 'libvirt-bin' package is installed
    - The 'libvirtd' daemon has been started
    - You are a member of the 'libvirtd' group

    Libvirt URI is: qemu: /// system

    Traceback (most recent call last):
    File "/usr/share/virt-manager/virtManager/", line 1027, in _open_thread
    self.vmm = self._try_open ()
    File "/usr/share/virt-manager/virtManager/", line 1009, in _try_open
    File "/usr/lib/python2.7/dist-packages/", line 102, in openAuth
    if ret is None: raise libvirtError ('virConnectOpenAuth () failed')
    libvirtError: Could not connect socket to '/ var / run / libvirt / libvirt-sock': Permission denied

    Does anyone have any idea how to fix this?

    PS: I already verified that the libvirt-bin package is installed and also added my user to libvirtd. The thing to check if the libvirtd daemon started I have no idea how to do it XD. First of all, Thanks!

    1.    Cocolio said

      ahhhh another reason why I hated Linux, I remember that I had to run something with sudo for that and apart before starting the Vbox because I had to use a command to unlock the hardware virtualization, if I find it, I'll pass it to you.

      1.    ahdezzz said

        I already solved it, I just needed to restart 😛

        1.    eliotime3000 said

          And why didn't you check if the system warned you that it required a restart? Because in my case, as I use Debian, it asks me to restart as long as I do these things that are directly related to the kernel.

      2.    eliotime3000 said

        I don't hate the GNU / Linux system, but GNU / Linux distros that really suck when it comes to doing this kind of task like normal Ubuntu (the LTS are at least decent enough to work, but as far as to the proprietary drivers, when updating they always cross).

        I have the VirtualBox in Debian Oldstable and so far it has not given me problems (except when I wanted to run a machine with the Xen kernel that I installed) and it works wonders.

        If you want to enter facebook, work your Office documents or simply have a better performance in your Steam games, use normal Ubuntu or LTS; but if you want virtualizations, secure servers, human-factor fail-safe stability, then go for CentOS / RHEL, Slackware and / or Debian Stable.

        1.    eliotime3000 said

          PS: I use the Chromium 25 that I got from the Launchpad (hence why the heck does it appear to me like I'm using Ubuntu when actually I'm using Debian Oldstable {Squeeze}).

  11.   dwarf said

    I have a problem although the truth is that the comments are not the ideal place to discuss this so I opened a thread in the forum to be able to discuss calmly.

    Link here

    1.    eliotime3000 said

      Try to rule out if the QEMU that is misconfigured with other VM systems like VirtualBox OSE or Xen.

      Now, I'm testing if ZPanelX really works in Wheezy using the script designed for Ubuntu 12.04 LTS.

      1.    petercheco said

        I am using ZPanel on my Wheezy. You can get it from the official page and it works without any problem:

      2.    petercheco said

        Logically as pre-required packages you don't install:

        yum install curl


        apt-get install libc6 curl

        The libc6 package includes the package 😀

        1.    eliotime3000 said

          Thank you very much for taking a load off me. What's more, I already have a preview in this blog saved in draft, so I want to clarify these steps to follow (in addition to including you in the credits of my research) and of course, put a screenshot in which I have the ZPanel X control panel with Debian Wheezy from a browser (forgive me if the screenshot I make was done in Windows 7, but the crap of the PC I have and the internet speed I use does not allow me to get the most out of it with virtual machines so that I have to resort to the PCs that are in the computer institute in which I study).

          When I tried that control panel in Windows, I realized how simple to operate, but inexplicably it was extremely slow and so I was inclined to look for how to install it in Debian Squeeze without success, until Wheezy arrived and the way was illuminated.

  12.   Eduardo said

    Excellent! You have tempted me 🙂
    To prove it.
    What would be the performance advantages in virtual machines with the other virtualization environments?

  13.   Federico Antonio Valdés Toujague said

    Thank you all for your comments !!!.
    KVM is like Xen, a Hypervisor. Its performance is VERY superior to that obtained with VirtualBox, or VMware Workstation or Server. You are told by one who has servers in production since 2005 using VMware Server. I don't delete them because the hosts are old and their processors don't have the extensions. In my workstations in my company and in my house, I deleted all the virtual machines and made them from scratch with the QUEMU-KVM, and there were 6 machines in total.

    1.    eliotime3000 said

      I stopped using VMWare Workstation because it really is a resource hog when it comes to virtualizing and it does not have an automated driver installer like the one VirtualBox has (hence why I have become adept at it).

      As for the QEMU, I would have to try it in Wheezy, since in Squeeze (the version in which I have installed on my obsolete PC), the drivers are outdated and my biggest fear is that it does not have a compatibility for its drivers in Windows NT 5 .x and higher.

  14.   izzyvp said

    Good post friend,
    [code] # adduser myuser libvirt [/ code]
    nothing more than in that line you missed a "d" at the end

    1.    Federico Antonio Valdés Toujague said

      Read the article slowly, especially where it says Note on Ubuntu. In Debian Squeeze or Wheezy the group is libvirt, while in Ubuntu it is libvirtd.

  15.   Warper said

    Some manual for dummies? Because I've tried it, and there's no way. When I go to create the virtual hard disk I get an error. I have given write permissions and not for those. I think I'll continue with VirtualBox, which at least has never given me errors and the installation is very easy

  16.   anonymous said

    If instead of gnome we use lxde or openbox 150 MB are more than enough.

  17.   JP said

    I have never had problems with virtualbox although I find it interesting to virtualize x64 systems on PCs with i386 processor

  18.   Daniel said


    It's incredible! I was a regular VirtualBox user, now I started with QEMU-KVM and it is a totally different world and indeed I dare to say that it is superior.

    I had many stumbles at the beginning, but it is only a matter of looking for him

    * To begin with, I did not finish creating the virtual machine because the network had not been configured, for this it turns out that I did not have the iptables modules in my kernel (I use a 3.9.2 kernel compiled by me), necessary to create the NAT network , once the kernel was re-compiled with these modules, I finished creating the virtual machine

    * Secondly, it took too long to install the OS (Windows by necessity of work), it turned out that it is due to the configuration of the virtual hard disk, first you have to create a virtual hard disk in qcow2 format with the prealloc option, in this page, is well explained , but beware, in the disk Bus option, do not select Virtio yet, since first you must have the driver installed in the virtual machine so that you can boot the virtual hard disk
    With this done, the overall speed of the virtual machine increases considerably

    * Third, for those who install windows guest, this guide is very useful since it tells us how to install the Virtio drivers for the hard disk and VGA that also greatly increase the user experience

    I also recommend you take a tour of the qemu page and its forums, they have interesting articles

    In short, I stay with QEMU-KVM!


  19.   Necho said

    Excellent I have tried it by virtualizing a CentOS and it works great. And best of all, it works excellent without the need for addons or the like….

  20.   Arthur said

    Hello, a question I have tried to install following the steps, I download debian 7 from the page but when I try to install it marks me that it does not find libvirt-bin, I have looked for information but no manual comments on repositories for installing libvirt.
    someone out there to give me an idea of ​​what I can do

    Thank you

  21.   German said

    Skinny thank you very much this was what I was looking for.

    : )

    1.    Federico Antonio Valdés Toujague said

      There is no reason to. Glad it serves you. Ahhhhh, and it's Fico or Federico. 🙂

  22.   Esteban said

    Hello good:
    I try to install qemu-kvm and it doesn't let me get this:

    # apt-get install qemu-kvm libvirt-bin bridge-utils virt-manager hal
    Reading package list ... Done
    Creating dependency tree
    Reading the status information ... Done
    E: The qemu-kvm package could not be located
    E: The libvirt-bin package could not be located
    E: The virt-manager package could not be located

    Can somebody help me. I've done a lot of testing and I'm stuck.


    1.    Arthur said

      Hello Esteban, the same thing happened to me, but I tried to add more repositories from the debian page, and with that I could install the packages


      1.    Marcelo said

        Hi arturo, one question I'm new to using linux in general, but how do I add repositories to debian?

        thanks in advance

  23.   trullin said

    Theory and practical images are brought together in a harmonious XD tutorial. Excellent tutor.

    1.    Federico A. Valdés Toujague said

      Thanks for your praise and comment !!!

  24.   federico said

    How can I manage two ethernet network cards in qemu? one for my host and one for qemu. I do it because I have two access points with independent connections. And my idea is to use a couple downloads with torrent (virtual machine in qemu) and the other for daily use in my archlinux) (host)