KVM Virtual Machine Introduction

Source: Internet
Author: User
Tags svm

KVM Virtual Machine Introduction
Introduction to a KVM Virtual Machine (kernel-based Virtual Machine) is an open-source system virtualization module. It has been integrated into major Linux releases since Linux 2.6.20. It uses the Linux Scheduler for management, so compared with Xen, its core source code is few. KVM has become one of the mainstream VMM in the academic field. KVM virtualization requires hardware support (such as Intel VT or amd v ). Is hardware-based full virtualization. In the early days, Xen was based on Para-Virtualization simulated by software. The new version was based on full Virtualization supported by hardware. However, Xen has its own process scheduler and storage management module, so the code is huge. The widely spread commercial system Virtualization software VMware ESX series is also based on software simulation of Para-Virtualization. 2. install and use the KVM Virtual Machine. 1. Prepare 1.1. confirm that the machine has a VT terminal. Enter the command: grep vmx/proc/cpuinfo (INTEL chip) grep svm/proc/cpuinfo (AMD chip) if you do not know the chip manufacturer, enter: egrep '(vmx | svm)'/proc/cpuinfo. If vmx or svm is in flags:, VT is supported. If no output is available, it indicates that your cpu is not supported and the KVM virtual machine cannot be successfully installed. 1.2 make sure that VT: Intel (R) Virtualization alization Tech [Enabled] is Enabled in the BIOS, and if necessary, enable the VT-d1.3 In the BIOS to ensure that the kernel version is newer, you can use uname-r to view the kernel version of KVM. If the kernel version is 2.6.20 or earlier, you need to upgrade the kernel. 2. Install the KVM and install the KVM Virtual Machine in Ubuntu and CentOS. Use guest to log on to Ubuntu and run the following command to install KVM: sudo apt-get install kvm qemu-kvm virt-manager kernel-package linux-source kqemu-source build-essentialkvm will have/dev/kvm after installation is successful. If no graphic manager is required, you only need to install the first three. Check whether the KVM is successfully installed. Run virsh-c qemu: // system list. If the input result is as follows, Connecting to uri: qemu: /// systemId Name State ---------------------------------- Note 1: When installing CentOS, you must first select Selinux as enalble and use the command # system-config-securitylevel-tui to view or modify the status of selinux. NOTE 2: when using root to log on to CentOS, the installation command is: yum install kvm kmod-kvm qemu and then mount the kvm module: modprobe kvm-intel (Intel machine) or modprobe kvm-amd (amd machine) Note 3: You can run the following command to check whether the kvm module is mounted: /sbin/lsmod | grep kvm if information about the kvm version is output, it is loaded into the kvm module. NOTE 4: After installation, you can run the qemu-kvm command and enter the command, if the system displays an Unknown command, check whether the qemu-kvm executable file exists in/usr/libexec. If yes, copy it to the/bin directory. If the qemu-kvm executable file is not found in/bin,/usr/libexec,/usr/bin,/usr/sbin after the preceding steps, run the following command: # yum provides "*/qemu-kvm" Note 5: some software versions may be too low and incompatible after the new kernel is installed. For example, firefox cannot be started because of its low version. Run the following command in CentOS to update the software (firefox is used as an example): # yum update firefox3 install Virtual Machine 3.1 In KVM and use QEMU to create a disk image sudo qemu-img create-f qcow windows. img 8g Note: Qemu-img create-f qcow2 windows in CentOS and qemu. img 8G3. 2. Install the sudo KVM-localtime-cdrom/dev/cdrom-m 512-boot d win2.img hard disk by using kvm to install the Guest VM. img-cdrom winxp. iso-boot d-clock-rtc-no-acpi Note: The-no-acpi parameter is officially recommended because qemu/kvm is not supported and may cause cp U usage is high. Note 1: qemu-kvm-localtime-m 512-hda windows is installed on the hard drive of CentOS. img-cdrom winxp. in iso-boot d-no-acpi, you must remove the-clock rtc option. Otherwise, the clock cannot be initialized. NOTE 2: CentOS quest mouse: export SDL_VIDEO_X11_DGAMOUSE = 0 solves the problem of unrecognized USB mouse in VM. NOTE 3: When Windows 7 is installed, the-no-acpi option cannot be used. 4. Start Guest ① sudo KVM-boot c-m 512-hda windows. img ② sudo kvm-boot c-m 512-hda/home/lm/kvm/winxp. img-localtime-net nic, vlan = 0, macaddr = 52-54-00-12-34-01-net tap, vlan = 0, df = h, ifname = tap0, script = no-clock rtc-soundhw es1370-smp 2 Note: In the KVM-87, remove df = h-m 512 allocated 512MB memory-hda/home/lm/kvm/winxp. img-localtime uses the local time (this parameter must be added, or the VM time may be faulty)-net nic, vlan = 0, macaddr = 52-54-00-12-34-01-net tap, vlan = 0, df = h, ifname = Tapo and script = no use the network and connect to an existing network device tap0. Note that you must compile the mac address yourself. Especially if you have virtualized multiple systems and want to run them at the same time, otherwise MAC conflicts, remove df = h-boot d in the KVM-87 from the disc boot (from the image boot is also used this. Boot from the hard disk is-boot c)-smp 2 smp processor number is 2, if you are a 4-core processor, the following number is 4-clock rtc using the rtc clock (If this option is not enabled, WINXP may be slow)

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.