Linux Introductory Learning Tutorial: KVM for virtual machine experience

Source: Internet
Author: User
Tags cpu usage

In the previous article, I demonstrated the use, effects, and performance of the virtual machine software QEMU, as well as the different users ' quest for virtual machines. But whether it is desktop users or enterprise users, the pursuit of virtual machine software is a bit common, that is performance. QEMU is a powerful virtual machine software that simulates all the hardware required for a complete computer in the form of software, even the hardware that simulates different architectures, on which the complete operating system can be installed. The operating modes of QEMU are as follows:

It is clear that this form of software-based simulation of hardware is powerful, but performance is difficult to meet the needs of users. The performance of the simulated hardware and the performance of the physical hardware will inevitably be greatly compromised. To improve the performance of virtual machine software, developers are recount. Among them, the most common way is to open a hole in the main operating system through the kernel module, through this hole to map the operation of the virtual machine directly to the physical hardware, thereby improving the performance of the operating system running in the virtual machine. Such as:

KVM is a typical representation of this acceleration pattern. In the community, KVM and Xen are often compared, but they are totally different. As can be seen, the use of kernel modules to accelerate this mode, the main operating system is still dominant, the kernel module just open a hole in the main operating system, to connect the virtual machine and physical hardware, to the virtual machine, but the virtual machine in the guest operating system is still subject to great limitations. This model is more suitable for desktop users, the main operating system is still their battleground, whether it is the office or play games, all through the main operating system, the customer operating system is just on-demand use. As for Xen, the use of different concepts, more suitable for enterprise-class users, desktop users do not easily touch, specific content next I say.

In fact, VirtualBox is also taking this mode of kernel module acceleration. I say this because it will require the installation of dkms when installing VirtualBox. Such as:

Familiar with the Linux people know, dkms is to facilitate the user to manage the kernel module and exist, not familiar with dkms Google can also know a bit about. As for the specific use of VirtualBox, I'll talk about it in the next article. This article is mainly about KVM.

KVM and QEMU are mutually reinforcing, and qemu can use the KVM kernel module to accelerate, and KVM needs to run the virtual machine using QEMU. As you can see, if you want to install KVM using Ubuntu's package management software, the QEMU-KVM is actually installed. And QEMU-KVM is not a very complex package, it contains only a few files, such as:

Look at its documentation with the Man command and discover that the QEMU-KVM package not only contains very few files, but also that its executable KVM is just a simple wrapper for the qemu-system-x86_64 command, such as:

So the question is, which package does the KVM kernel module provide? In fact, since the start of Linux 2.6, KVM has been added to the kernel. If you do not want to find out which package the KVM kernel module Kvm.ko is provided by, you can look at it with the following command:

As you can see, the use of KVM is simple enough to write here. Below, I use KVM to run the WinXP operating system installed in the previous article and experience the efficiency of QEMU's KVM acceleration. Use the following command to run the QEMU with KVM acceleration:

As you can see, with KVM acceleration, the WinXP in the virtual machine is running a lot faster and it only took 34 seconds to boot. I adjusted the resolution to 1366*768, and the graphical interface ran smoothly, no matter whether I opened IE or office Office software, and no more CPU usage soared to 100%. If you use ps-ef | grep QEMU commands to see if the KVM command is running the QEMU-SYSTEM-X86_64 program, except for the-ENABLE-KVM parameters, such as:

In addition, for desktop users, there is a good graphical interface is also very important. Although Qemu and KVM themselves do not have a virtual Machine manager with a graphical interface, we can use 3rd party software, such as Virt-manager. You only need to use the sudo apt-get install virt-manager to install the software. The software relies on Libvirt and is automatically installed during the installation process. The effect of running Virt-manager is, note that you must run with sudo because the software requires Superuser privileges:

The software automatically identifies whether the virtual machine environment in the system is QEMU+KVM or Xen. Create a new virtual machine and choose to import an existing hard disk image because you have previously installed a WinXP system. After you click Next, the following interface appears:

This step is nothing to say, then the next step, such as:

You can set network options here. If you check "Custom configuration before Installation", you can further customize your hardware, such as:

In, we can see the types of virtual graphics that are supported by the virtual machine, and here, of course, I chose VMVGA, because I used to use VMware to know that these operating systems run without problems with VMware's virtual graphics settings. Of course, the other options can be tried, but in the virtual operating system you need to install the appropriate driver.

Finally, the virtual machine runs as follows:

As you can see, the program provides an interface with a very rich menu of features that are very powerful and can even send combination keys to the operating system in the virtual machine.

So to speak, if there is no VirtualBox, the QEMU+KVM combination should be the preferred choice for desktop users. Next I will try Virtualbox,virtualbox claims to be the most powerful open-source virtual machine system, see Linux Introductory Tutorial: Virtual Machine Experience VirtualBox Chapter http://www.linuxidc.com/Linux/ 2015-03/114463.htm.

--------------------------------------Split Line--------------------------------------

RHEL6 KVM Virtualization creates bridged network cards-bridge http://www.linuxidc.com/Linux/2013-08/88517.htm

RedHat Linux KVM Virtual machine bridging http://www.linuxidc.com/Linux/2013-02/79934.htm

CentOS 5.6 KVM Installation/bridging setup/virtual machine creation and Operation Http://www.linuxidc.com/Linux/2012-12/76883.htm

/BIN/QEMU-KVM problem resolution is not found when installing a KVM virtual machine with Libvirt under Ubuntu http://www.linuxidc.com/Linux/2013-08/88985.htm

RedHat6.5 Install the KVM virtual machine http://www.linuxidc.com/Linux/2014-10/107972.htm

--------------------------------------Split Line--------------------------------------

This article permanently updates the link address : http://www.linuxidc.com/Linux/2015-03/114462.htm

Linux Getting Started learning Tutorial: KVM for virtual machine experience

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.