Installing a KVM virtual machine on a Linux system CentOS 6

Source: Internet
Author: User

First, KVM Introduction

KVM is open source software, the full name of kernel-based virtual machine (kernel-based VM), is an open source system virtualization module, hardware-based complete virtualization, but requires hardware support (such as Intel VT Technology or AMD V technology). Since Linux 2.6.20 is integrated in each major release of Linux. It is managed using Linux's own scheduler, so its core source code is few compared to Xen. KVM has become one of the mainstream VMM in academia today.

Second, KVM installation

1. Preparatory work

    • Close Iptables Firewall

    • BIOS turn on CPU support virtualization (typically enabled by default)

    • See if the CPU supports full KVM virtualization

To view the method:

# Cat/proc/cpuinfo | Egrep--color=always ' VMX|SVM ' #如有信息输出则可判断支持

2. Installing virtualization-related packages

System Yum Upgrade

#yum Update (or #yum upgrade)

Install the Virtualization and graphics Desktop Package group

#yum-y Groupinstall "virtualization" "desktop" "X Window System" "Desktop Platform"

Installing KVM-related

#yum-y install KVM libvirt libvirt-python python-virtinst virt-manager qemu-kvm-tools virt-viewer virt-v2v

Restart the system after installation is complete

#reboot

3. View the loaded KVM module

# Lsmod|grep KVM

Kvm_intel 55656 6

KVM 345659 1 Kvm_intel

# STAT/DEV/KVM

File: "/DEV/KVM"

size:0 blocks:0 IO block:4096 character Special file

device:5h/5d inode:10640 links:1 Device Type:a,e8

Access: (0666/crw-rw-rw-) Uid: (0/root) Gid: (36/KVM)

Access:2016-04-21 17:20:39.789558372 +0800

Modify:2016-04-21 17:20:39.789558372 +0800

Change:2016-04-21 17:20:39.789558372 +0800


4. View LIBVIRTD Running Status

#/etc/init.d/libvirtd status

LIBVIRTD (PID 2491) is running ...

5. Configure Network bridging

Backup Ifcfg-eth0

#cp/etc/sysconfig/network-scripts/ifcfg-eth0/root

Create Br0

#cd/etc/sysconfig/network-scripts/

#cp Ifcfg-eth0 Ifcfg-br0

To view the contents of the configuration, here you have chosen to obtain an IP address automatically.

[email protected] network-scripts]# cat Ifcfg-eth0

Device=eth0

Type=ethernet

Onboot=yes

Nm_controlled=no

Bridge=br0

[email protected] network-scripts]# cat Ifcfg-br0

Device=br0

Type=bridge

Onboot=yes

Nm_controlled=no

Bootproto=dhcp

6. Restart the Network Service

#/etc/init.d/network restart

Third, install the virtual machine

Create 2 disk images for installing virtual machines in the/DATA/VM directory:

#qemu-img create-f raw/data/vm/vm01.img 10G #用于图形化安装虚拟机

#qemu-img create-f qcow2/data/vm/vm02.img 10G #用于命令行安装虚拟机

1. graphical installation of virtual machines with Virt-manager

Open application, System Tools, virtual System Manager

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/7F/47/wKioL1cYpyjRebpvAABt4QTIjaM535.png "title=" Virt-m.png "alt=" Wkiol1cypyjrebpvaabt4qtijam535.png "/>

Click the Create Virtual Machine button, enter the virtual machine name, point forward,

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/7F/49/wKiom1cYp3jQrVBMAADnvf9jsYM745.png "title=" 1.png " alt= "Wkiom1cyp3jqrvbmaadnvf9jsym745.png"/>

Select the mounted CD and OS options, point forward,

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/7F/49/wKiom1cYqCPipHTDAACpVEJHPbU461.png "title=" 1.png " alt= "Wkiom1cyqcpiphtdaacpvejhpbu461.png"/>

Determine the memory and CPU of the virtual machine, point forward,

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/7F/49/wKiom1cYqHGzalhKAACE2i6t_Nk068.png "title=" 1.png " alt= "Wkiom1cyqhgzalhkaace2i6t_nk068.png"/>

Enable an already built storage drive for a virtual machine, point forward,

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/7F/47/wKioL1cYqazw4nSUAACGdxg4iK0880.png "title=" 1.png " alt= "Wkiol1cyqazw4nsuaacgdxg4ik0880.png"/>

Next confirm the virtual machine information, click Finish to enter the installation system interface, installation steps here is not introduced.


2. command line to install the virtual machine commands are as follows:

#virt-install--virt-type kvm-n vm02-r 1024x768--disk path=/data/vm/vm02.img,size=10,format=qcow2-w bridge:br0--graphics vnc,listen=0.0.0.0--noautoconsole--os-type=linux--os-variant=rhel6--LOCATION=HTTP://192.168.1.166/CENTOS6

See which Port VNC is booting on

#virsh Vncdisplay vm02

The relevant parameters can be viewed in the Help

--location here uses the HTTP service to do the system's installation source, is the CD-ROM mount directory linked to the site root directory

The VNC interface can then be accessed using the VNC client software, which is the interface of the normal installation system.


3. Virsh commands for managing virtual machines

Virsh List

Virsh List all

Virsh Start VM01

Virsh shutdown VM01

Virsh Destroy VM01

Other related commands to see Help

#virsh-H

Installing a KVM virtual machine on a Linux system CentOS 6

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.