Linux getting started Tutorial: QEMU for Virtual Machine experience

Source: Internet
Author: User
Tags arch linux intel core i7

Linux getting started Tutorial: QEMU for Virtual Machine experience

Speaking of virtual machines, everyone is familiar with them. There are many scenarios where virtual machines are needed. For example, a comrade who is interested in writing an operating system often needs a virtual machine to run and debug the system he wrote; for example, if you like to study the network architecture, You need to virtualize N systems on your computer to form a variety of networks. (This requires strong computer configuration. Fortunately, I have enough computers .) For example, if you want to use Windows to play Linux or Linux, it is easier to use virtual machines. Finally, if you want to study the most popular big data and cloud computing technologies, I 'd like to try Hadoop, Spark, OpenStack, or something. I don't know how to set up an experiment environment on a virtual machine. I often use virtual machines myself. VMWare is used in Windows. I feel that it is powerful, easy to use, and highly efficient to run. Many of my blogs are made up of virtual machines. Can you tell them? In Linux, I also use virtual machines. For example, in my article titled writing 16-bit code that can run in x86 real-time mode using GCC and GNU Binutils, I used QEMU to run a FreeDOS system, used to debug my 16-bit code. In fact, I am also a master who likes to study the Operating System. QEMU started from the book "write the operating system yourself.

The classification of virtual machines is complex. What is fully virtual, what is semi-virtual makes people dizzy. I have used a lot of virtual machines, and I still cannot tell these concepts. In addition, desktop users and enterprise users have different expectations for virtual machines. For example, I may expect a virtual machine:

1. It can simulate a complete PC. I can install any operating system I want to install on it;

2. It should have a good graphic interface, and the simulated computer should be able to run Windows or Gnome graphics systems without any access, and it would be best to play games;

3. the hard disk used by the customer's operating system is an image file in the host operating system, which can be copied and pasted at any time and can be packed and taken away at any time;

4. It is best to simulate hardware that does not exist, such as multiple NICs.

Obviously, VMWare Workstation is such a virtual machine that perfectly satisfies my requirements. I often use it to toss various Linux releases and run smoothly. Of course, in the open-source world of Linux, we should not use such a cracked version. But don't worry. in Linux, virtual machine software such as VirtualBox and QEMU are available.

For enterprise users, the virtual machines they expect may be as follows:

1. It does not have to be able to simulate a complete computer, the focus is on CPU, memory, disk and network card, the focus is to be used as a server;

2. its performance must be good. The virtual CPU performance must be close to that of the physical CPU. It must make full use of all the features of the physical CPU. For the performance, you can only install the OS with the modified kernel; (so-called semi-virtualization technology .)

3. it must be highly isolated. Its purpose is to divide one machine into N machines for use. The more hosts that manage these n vms, the less resource they occupy, the better. The client is the master, the host is the same; (as Xen .)

4. because enterprise users are pursuing performance, the hard disk used by the client may be an independent physical hard disk, disk array, Network File System, or something, not just an image file on the host machine;

5. It does not necessarily need a graphical interface, because it is easier to manage using the command line interface, such as automation, remote, batch, or something;

6. More enterprise-level high availability requirements, such as hot backup and dynamic migration.

From the above expectations, we can see that the virtual machine field has a deep water and a broad market prospect. It is also common for virtual machine manufacturers to blow their own products, because every user can make a big fuss. The so-called Linyuan Linyu, it is better to get rid of the network, and all kinds of virtual machines are more enjoyable, it is better to try it yourself.

Today I am introducing QEMU. My blog post is not the user manual of the Software. Therefore, for more information, see QEMU's official website:

Http://wiki.qemu.org/Main_Page

Alternatively, enter the following command in your system:

Man qemu-system-i386

Man qemu-img

And so on...

QEMU itself is a very powerful virtual machine, and even QEMU is indispensable in Virtual Machine products such as Xen and KVM. QEMU can use Xen, KVM, and other technologies to accelerate QEMU. Why do we need acceleration? That's because when we use QEMU alone, it simulates a complete PC, and the CPU in it is simulated, it can even simulate CPUs of different architectures. For example, it can simulate an ARM computer or MIPS computer on an Intel X86 CPU, in this way, the simulated CPU running speed will definitely not keep up with the physical CPU. After acceleration, the CPU commands of the customer's operating system can be directly forwarded to the physical CPU, which naturally increases the running efficiency.

QEMU is also a very simple Virtual Machine. If you want to customize the configurations of this virtual machine, for example, you can specify the corresponding command line parameters for the CPU, video card, and network configuration. It supports Disk Images in many formats, including disk image files created by VirtualBox. It also provides qemu-img, a tool for creating and managing Disk Images. You can directly view the command line parameters used by QEMU and its tools.

Start to experience. First, let's take a look at the packages related to QEMU In the Ubuntu software source:

My computer is Intel's CPU, and I want to virtualize it is also a personal computer, so I naturally install qemu-system-x86, another useful is qemu-utils. View the tools and documents in the QEMU software package:

Use qemu-img to create a disk image file, start the virtual machine with a qemu-system-i386, and install the operating system:

WinXP is estimated to be the best download operating system on the entire network. After running the preceding command, the familiar system installation interface is displayed. I won't bother with the installation process. Is the effect after the WinXP operating system is installed. You can specify more parameters for the qemu-system-i386. When I start WinXP again, in addition to allocating 2 GB of memory to it, I also allocated two CPUs to it using the-smp 2 parameter, you can also use-vga vmware to specify the same graphics card as the VMWare Virtual graphics card. Although two CPUs are specified, the performance is still poor. Drag the window to see if the CPU usage has soared to 100%.

In addition, although the CPU in the virtual machine is displayed as 3.5 GHz, it is obviously simulated by QEMU, which is significantly different from the physical CPU. In fact, my computer configuration is quite powerful, Core i7-4770K quad Core eight thread CPU, please see the output of lshw:

Conclusion:

Intel Core i7-4770K CPU, virtual XP also allocated 2G memory and two CPUs, but the smoothness is still poor. It means that QEMU alone cannot meet the needs of our desktop users. What about Xen or KVM? Is there a qualitative leap in performance? We are looking forward to the next article "getting started with Linux: KVM for Virtual Machine experience.

Ubuntu 12.04 cannot find the Qemu command

Install QEMU + efi bios on Arch Linux

QEMU translation framework and debugging tools

QEMU code analysis: BIOS loading process

QEMU details: click here
QEMU: click here

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.