Getting started with Linux: KVM for Virtual Machine experience

Source: Internet
Author: User
Tags superuser permission

Getting started with Linux: KVM for Virtual Machine experience

In the previous article, I demonstrated the use, effect and performance of the Virtual Machine Software QEMU, and analyzed the different virtual machine pursuits of different users. However, whether it is a desktop or enterprise-level user, the pursuit of Virtual Machine Software is a bit common, that is, performance. QEMU is a powerful Virtual Machine software. It can simulate all the hardware required by a complete computer in the form of software, or even simulate hardware of different architectures, the complete operating system can be installed on these virtual hardware. The QEMU running mode is as follows:

Obviously, this kind of software simulation hardware is powerful, but its performance is hard to meet users' needs. Compared with physical hardware, the performance of the simulated hardware will inevitably be compromised. To improve the performance of the Virtual Machine Software, developers can see each other. Among them, the most common method is to open a hole in the main operating system through the kernel module, through which the operations in the virtual machine are directly mapped to the physical hardware, this improves the performance of the operating system running in the virtual machine. For example:

KVM is a typical example of this acceleration mode. In the community, KVM and Xen are often compared, but they are completely different. We can see that the main operating system is still dominant when kernel module acceleration is used. The kernel module only opens a hole in the main operating system to connect virtual machines and physical hardware, acceleration is provided for virtual machines, but the customer Operating Systems in the virtual machines are still greatly restricted. This mode is suitable for desktop users. The main operating system is still the main battlefield for them. Whether it is office or playing games, the main operating system is used. The customer's operating system is only used as needed. As for Xen, different concepts are completely used. Xen is suitable for enterprise-level users, and desktop users should not be easily touched. I will talk about Xen in the next article.

In fact, VirtualBox adopts this kernel module acceleration mode. This is because DKMS is required to be installed when VirtualBox is installed. For example:

People familiar with Linux know that DKMS exists to facilitate user management of kernel modules. People who are not familiar with DKMS can also learn about it by Google. I will talk about the specific usage of VirtualBox in the next article. This article focuses on KVM.

KVM and QEMU complement each other. QEMU can be accelerated using the KVM kernel module, while KVM needs to use QEMU to run virtual machines. We can see that if you want to use the Ubuntu package management software to install KVM, qemu-kvm is actually installed. Qemu-kvm is not a complicated software package. It only contains a few files, such:

Run the man command to check its documentation and find that the qemu-kvm package contains very few files, and its Executable File kvm is just a simple package for the qemu-system-x86_64 command, such:

So the question is, which package does the kvm kernel module provide? In fact, kvm has been added to the kernel since Linux 2.6. To find out which package kvm. ko is provided by the kvm kernel module, run the following command:

Here, we can see that the use of KVM is very simple. Next, I will use KVM to run the WinXP operating system installed in the previous article and try the QEMU's efficiency after KVM acceleration. Run the following command to run the QEMU accelerated by KVM:

It can be seen that after KVM acceleration, the running speed of WinXP in the virtual machine has increased a lot, and it takes only 34 seconds to start the system. I adjusted the resolution to 1366*768, and the graphic interface was running smoothly. No problem was found whether I opened the IE browser or the Office software, and no CPU usage soared to 100%. If you run the ps-ef | grep qemu command to check whether the kvm command runs the qemu-system-x86_64 program, but the-enable-kvm parameter is added, such:

In addition, it is also important for desktop users to have a good graphical interface. Although QEMU and KVM do not have a virtual machine manager with a graphic interface, we can use the 3rd-party software, such as virt-manager. You only need to use sudo apt-get install virt-manager to install the software. The software depends on libvirt and is automatically installed during installation. The effect of running virt-manager is as follows: note that sudo must be used to run the software, because the software requires the superuser permission:

The software automatically identifies whether the virtual machine environment in the system is QEMU + KVM or Xen. Create a new virtual machine. Because a WinXP system has been installed before, choose to import an existing hard disk image. Click next and the following page appears:

There is nothing to say about this step. Click Next, for example:

You can set network options here. If you select "custom configuration before installation", you can further customize the hardware, for example:

In, we can see all types of virtual graphics cards supported by virtual machines. Here, of course, I chose VMVGA, because I used to use VMWare, we know that these operating systems run well under VMWare's virtual graphics card settings. Of course, you can try other options, but you need to install the corresponding driver in the virtual operating system.

Finally, the virtual machine runs as follows:

As you can see, this program provides a rich variety of functional menus, which are very powerful. You can even send a combination of buttons to the operating system of the virtual machine.

In this case, the combination of QEMU and KVM should be the first choice for desktop users without VirtualBox. In the next article, I will try VirtualBox. VirtualBox is known as the most powerful open-source virtual machine system. For details, see the tutorial on getting started with Linux: VirtualBox for Virtual Machine experience.

-------------------------------------- Split line --------------------------------------

RHEL6 KVM virtualization creates a bridge NIC-Bridge

RedHat Linux KVM Virtual Machine bridging

Installation/bridging settings of KVM in CentOS 5.6/virtual machine creation and operation

The/bin/qemu-KVM problem cannot be found when the kvm virtual machine is installed with libvirt In Ubuntu.

Install and configure the KVM Virtual Machine in RedHat6.5

-------------------------------------- Split line --------------------------------------

This article permanently updates the link address:

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.