Building Rings
Environment
Operating system: CentOS 6.5 Final x86_64
Kvm:qemu-kvm-0.12.1.2-2.479.el6_7.3.x86_64
Tools: Win7 and Vnc-viewer (first install VNC on server, connect to server CentOS via VNC Viewer)
First, install KVM and related software
1. KVM requires CPU support (Intel VMX or AMD SVM) to check if the CPU provides virtual technology support before installing KVM:
[Email protected] kvm]# egrep ' ^flags.* (VMX|SVM) '/proc/cpuinfo|more
There is a display indicating that the processor has the VT function
2. Virtual Technolege (VT, virtualization) on the CPU in the motherboard BIOS
3. Installing KVM and its required packages
[email protected] kvm]# Yum install KVM KMOD-KVM qemu kvm-qemu-img virt-viewer virt-manager libvirt Libvirt-python Pytho N-virtinst
Or
[email protected] kvm]# Yum Groupinstall KVM
4, check whether the KVM module is installed, using the following command to display two modules means the installation is complete
[Email protected] kvm]# Lsmod | grep KVM
Kvm_intel 52570 0
KVM 314739 1 Kvm_intel
Second, start the Virt-manager management interface
1, the Client
Vnc-viewer to server-side, requires server to install graphical interface.
2. Server-side
[Email protected] kvm]# yum–y install Tigervnc-server
[Email protected] kvm]# vncserver:1
Note: The default: 1 is 5901 port, please notice the firewall
Start the LIBVIRTD service and guarantee the next auto-start
[[Email protected] kvm]# service LIBVIRTD start
Starting LIBVIRTD daemon: [OK]
[Email protected] kvm]# chkconfig LIBVIRTD on
Iii. remote creation of a KVM virtual machine
Use VNC Viewer as connected, ip:1
650) this.width=650; "height=" 216 "title=" image "style=" border:0px; "alt=" image "src=" http://s3.51cto.com/wyfs02/M01 /78/ff/wkiom1ae3gxzg4eoaaai71nlshq868.png "border=" 0 "/>
1. Open application=> System Tools and virtual Machine Manager to install VMS, similar to VMware
650) this.width=650; "height=" 584 "title=" image (2) "style=" border:0px; "alt=" Image (2) "src=" http://s3.51cto.com/ Wyfs02/m02/78/ff/wkiom1ae3gadc-0faabxsf3eyxw433.png "border=" 0 "/>
2, right click "localhost" this line, "New" appears
650) this.width=650; "height=" 586 "title=" image (3) "style=" border:0px; "alt=" Image (3) "src=" http://s3.51cto.com/ Wyfs02/m00/78/ff/wkiom1ae3gedhsb7aab0vpjcgbs314.png "border=" 0 "/>
3. Enter the virtual machine name
650) this.width=650; "height=" 591 "title=" image (4) "style=" border:0px; "alt=" Image (4) "src=" http://s3.51cto.com/ Wyfs02/m01/78/ff/wkiom1ae3gmiwug3aadd6ag6p8q443.png "border=" 0 "/>
4. Select the ISO file to install the system
650) this.width=650; "height=" 590 "title=" image (5) "style=" border:0px; "alt=" Image (5) "src=" http://s3.51cto.com/ Wyfs02/m02/78/fd/wkiol1ae3ims3g2vaadj6ajzxuq862.png "border=" 0 "/>
5. Set the memory size and CPU core number
650) this.width=650; "height=" 587 "title=" image (6) "style=" border:0px; "alt=" Image (6) "src=" http://s3.51cto.com/ Wyfs02/m01/78/ff/wkiom1ae3g2s7s9taacdet6npve860.png "border=" 0 "/>
6. Allocate virtual disk size, select Cancel "Assign Now" here
650) this.width=650; "height=" 594 "title=" image (7) "style=" border:0px; "alt=" Image (7) "Src=" http://s3.51cto.com/ Wyfs02/m02/78/ff/wkiom1ae3g_spx80aadcvp9-pui292.png "border=" 0 "/>
7, we choose to use the default network connection mode, and then re-modify
650) this.width=650; "height=" 627 "title=" image (8) "style=" border:0px; "alt=" Image (8) "src=" http://s3.51cto.com/ Wyfs02/m00/78/fd/wkiol1ae3i_jfrnbaade7pi4zw0456.png "border=" 0 "/>
8, start the virtual machine, you can see the system installation Interface
650) this.width=650; "height=" 522 "title=" image (9) "style=" border:0px; "alt=" Image (9) "src=" http://s3.51cto.com/ Wyfs02/m01/78/ff/wkiom1ae3hsbphv9aak2mso9gni355.png "border=" 0 "/>
9, install the system after the virtual machine restarts, the installation of the virtual machine has been completed
650) this.width=650; "height=" 591 "title=" image (Ten) "style=" border:0px; "alt=" image () "Src=" http://s3.51cto.com/ Wyfs02/m02/78/ff/wkiom1ae3hbchmlmaacsmswvtrg500.png "border=" 0 "/>
Four, in the remote management of KVM virtualized physical host process, can dynamically adjust the memory of the VM, the implementation of clone, boot, shutdown, suspend the host and other operations.
1. The server side uses the Virsh List command to view the host virtualization situation
[Email protected] kvm]# Virsh list
Id Name State
----------------------------------------------------
2 Tsm-pro-test2 Running
[Email protected] kvm]#
I have a centos virtual machine on it, named Tsm-pro-test2.
2, the KVM virtual machine information is saved in the/var/lib/libvirt directory
650) this.width=650; "height=" "title=" image (one) "style=" border:0px; "alt=" image (one) "src=" http://s3.51cto.com/ Wyfs02/m00/78/ff/wkiom1ae3hbrl-j2aaaf483gpwg455.png "border=" 0 "/>
3. KVM Default Network configuration
KVM Internet has two configurations, one is default, it supports host and virtual machine visits, but also supports virtual machine access to the Internet, but does not support external access to virtual machines. Another way is bridge mode, which can be used as a host with independent IP in the network.
Five. Configure the bridge connection mode
1. Create a bridge
Under the/etc/sysconfig/network-scripts directory, create a ifcfg-br0 file with the type set to bridge:
[Email protected] network-scripts]# more Ifcfg-br0
Device=br0
Onboot=yes
Type=bridge
Bootproto=static
ipaddr=10.0.0.15
netmask=255.255.255.0
gateway=10.0.0.1
[Email protected] network-scripts]#
2. Bridge the physical interface to the bridge
Modify the contents of the eth0 (the server is using eth0 Internet), remove its IP-related information, plus "Bridge=br0", to bridge it to br0; if it is a dual network card or multiple network cards, follow this procedure to modify:
[email protected] network-scripts]# cat Ifcfg-eth0
Device=eth0
Type=ethernet
Onboot=yes
Nm_controlled=yes
Bootproto=dhcp
Bridge=br0
[Email protected] network-scripts]#
3. Restart the Physical Machine Network Service
[Email protected] ~]# service network restart
4. View current bridging conditions (one virtual machine is running)
[Email protected] network-scripts]# Brctl Show
Bridge name Bridge ID STP enabled interfaces
Br0 8000.98BE944266A2 No eth0
Vnet0
Virbr0 8000.5254007820DD Yes Virbr0-nic
[Email protected] network-scripts]#
5. Bridge the virtual machine interface to the bridge
# brctl Delif virbr0 vnet0
# brctl AddIf br0 vnet0
This step can also be done in virtual Machine Manager.
650) this.width=650; "height=" 508 "title=" image () "style=" border:0px; "alt=" Image () "Src=" http://s3.51cto.com/ Wyfs02/m01/78/ff/wkiom1ae3hirbtxuaaguhraeiam834.png "border=" 0 "/>
6. Set the virtual machine CentOS KVM IP to the same segment address: 10.0.0.*
At this point, the virtual machine can access the external network and can be accessed by the external network.
Installing the configuration KVM on Centos 6.5