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 2.xxx (like me), we recommend installing the following packages as a minimum:
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.
Table of Contents
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 / Linux, Windows, 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 (x86, x86-64, PowerPC, MIPS, SPARC, etc.). He is licensed in part with the LGPL and LPG de GNU.
Kernel-based Virtual Machine o KVM, (in Spanish, Kernel-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.
- / 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 192.168.122.0/24 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.
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 !.