Installing a KVM virtual machine in CentOS 6.5

Source: Internet
Author: User

First, See if the server supports virtualization

GREP-E-o ' VMX|SVM '/proc/cpuinfo

If the system has output is to support virtualization, my input interface is as follows

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/80/22/wKioL1c5XfODq5LBAAAGUpQgvjM339.png "title=" Vmx.png "alt=" Wkiol1c5xfodq5lbaaagupqgvjm339.png "/>

Second, create two storage directories on the physical machine for storing ISO and img image files, for example, put it under /home

mkdir–p /home/iso

mkdir – p/home/kvm/img

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/80/25/wKiom1c5Xp3DUx3QAAAE_1TDrlU094.png "title=" Picture 1.png "alt=" Wkiom1c5xp3dux3qaaae_1tdrlu094.png "/>

Third, Installing virtual machine components, virtual machines using bridged networks, using the yum installation method

yum-y Install KVM KMOD-KVM qemu kvm-qemu-img virt-viewer virt-manager qemu-kvm libvirt python-virtinst bridge-utils

Four, Check if the kernel has been loaded to complete the KVM component

Lsmod |grep KVM

Five, Configure the networkcard,eth1 is the bridge network card address, the specific parameters are as follows    

Create Bridge network adapter command: virsh iface-bridge eth1 br0 or directly edit the NIC configuration file

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/80/23/wKioL1c5YGOi0Hr4AAAMNOigdEM429.png "style=" float: none; "title=" Image 3.png "alt=" Wkiol1c5ygoi0hr4aaamnoigdem429.png "/>

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/80/25/wKiom1c5X33iLqmPAAALJ01jvlo303.png "style=" float: none; "title=" Image 4.png "alt=" Wkiom1c5x33ilqmpaaalj01jvlo303.png "/>

C entos6.5 introduces the concept of networkmanage, you need to close the service first, and then Restart the network

Service NetworkManager Stop

Service Network restart

If the physical machine is installed for the first time, because the network card is inactive, it is necessary to restart the physical machine to use the network card, the network card status is as follows

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/80/25/wKiom1c5YDLDNPJRAABjuQi6yRs670.png "title=" Picture 5.png "alt=" Wkiom1c5ydldnpjraabjuqi6yrs670.png "/>


Note : The eth1 Nic is bridged with the br0 NIC, so the eth1 network card does not display IP it's normal.

To view the bridging state using the Brctrl show command

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/80/23/wKioL1c5YXjTdicOAAAKLorxCAI969.png "title=" Picture 6.png "alt=" Wkiol1c5yxjtdicoaaaklorxcai969.png "/>

Six, The following starts the installation of the virtual machine, you need to establish a virtual machine image img file before installation, or the virtual machine will not be able to install, can be established using the installation command, you can also use the command line to create a separate

virt-install--connect qemu:///system-n centos65-r 1024x768--vcpus=2--disk Path=/home/kvm/images/centos65.img,cache =writeback,size=10-c/home/iso/centos-6.5-x86_64-bin-dvd1.iso--vnc--vnclisten=0.0.0.0--vncport=5901-- Noautoconsole--os-type linux--accelerate--network bridge=br0 --HVM

whichNrepresents the name of the virtual machine,Rrepresents the memory given to the virtualVcpusthat is given to the virtual machine.CPUQuantity,Disk Pathindicates where the virtual machine will be loaded,- Cindicates which carrier installation is used,VNCDon't talk,Accelerateenable virtual machine accelerationBridgeThis block means using bridging,HVMexpressed as using full virtualization (and, of course, semi-virtualized)Noautoconsoleidentify using our VNC Console Otherwise, the virtual machine starts a console itself and starts the installation screen.

When the command is completed, the system prompts

Ready to install with VNC Console link

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/80/25/wKiom1c5YQ_gD8XoAAAM9RX-L4I859.png "style=" float: none; "title=" Image 7.png "alt=" Wkiom1c5yq_gd8xoaaam9rx-l4i859.png "/>

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/80/23/wKioL1c5YfaQDo69AAAKkIoJHDE087.png "style=" float: none; "title=" Image 8.png "alt=" Wkiol1c5yfaqdo69aaakkiojhde087.png "/>

Seven, Download a green version of vncviewer and follow the ports to open the console

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/80/26/wKiom1c5YW7QYGHRAAAi1DNvBEw859.png "style=" float: none; "title=" Image 9.png "alt=" Wkiom1c5yw7qyghraaai1dnvbew859.png "/>

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/80/23/wKioL1c5YlXDjC2dAABFR_Eic70822.png "style=" float: none; "title=" Image 10.png "alt=" Wkiol1c5ylxdjc2daabfr_eic70822.png "/>

Eight, vnc virsh enter virsh console, using list – All command to view the status of the virtual machine, using start centos65 Span style= "font-family: ' The song Body '; > When you start the virtual machine, you get the following status, and of course you can use shutdown centos65

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/80/23/wKioL1c5YoqAIgoyAAAGUf3M0-s047.png "title=" Picture 11.png "alt=" Wkiol1c5yoqaigoyaaaguf3m0-s047.png "/>

Nine, you need to use vncdisplay centos65 to get the vnc number

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/80/26/wKiom1c5YcjBisjUAAACk1ZRE0M080.png "title=" Picture 12.png "alt=" Wkiom1c5ycjbisjuaaack1zre0m080.png "/>

Once again, using the vncviewer link virtual machine for final setup, the virtual machine is created.

Summarize the techniques that you might use with command line methods (the following command, if not operated in the virsh console, requires the virsh command as a prefix, such as Virsh Dumpxml.... )

1,   xml configuration files are stored by default in /etc/libvirt/qemu/ below, default and img The name is the same, /etc/libvirt/qemu/centos65.xml img

2. from a file import to Virsh for Management, you need to use virsh Console and enter

Define/etc/libvirt/qemu/xxxx.xml the location of the configuration file, you can use Virsh to manage the

3. You can force the virtual machine to shut down by using destroy CENTOS65(specific name modification) when you encounter a virtual machine that cannot be shut down

4. Deleting a virtual machine from Virsh can use undefine centos65

5. Boot the virtual machine automatically, you can use autostart centos65

6. cloning a virtual machine virt-clone – o centos65 – N centos65-1 – f/home/kvm/img/new.img

7. add configuration to the virtual machine, I like to modify the XML file, or you can use the edit Centos65

8. To print an XML file, you can use dumpxml centos65








This article from "Liu June Linux" blog, declined reprint!

Installing a KVM virtual machine in CentOS 6.5

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.