Third, KVM Virtualization deployment
#安装kvm软件包
Yum-y Install KVM python-virtinst libvirt tunctl bridge-utils virt-manager qemu-kvm-tools virt-viewer virt-v2v
#补充安装kvm虚拟化一些管理工具包
Yum-y Install Libguestfs-tools
#查看虚拟机运行情况并开启
[[email protected] network-scripts]# service LIBVIRTD Status
LIBVIRTD is stopped
[[email protected] network-scripts]# service LIBVIRTD start
Starting LIBVIRTD daemon: [OK]
[email protected] network-scripts]# virsh-c qemu:///system List
Id Name State
----------------------------------------------------
#查看加载模块
[email protected] network-scripts]# lsmod | grep KVM
Kvm_intel 55496 0
KVM 337772 1 Kvm_intel
#查看虚拟工具版本
[Email protected] ~]# Virsh--version
0.10.2
[Email protected] ~]# ln-s/USR/LIBEXEC/QEMU-KVM/USR/BIN/QEMU-KVM
[Email protected] ~]# qemu-kvm-version
QEMU PC Emulator version 0.12.1 (qemu-kvm-0.12.1.2-2.479.el6_7.4), Copyright (c) 2003-2008 Fabrice Bellard
#配置桥接网卡
[email protected] ~]# cd/etc/sysconfig/network-scripts/
[email protected] network-scripts]# cat ifcfg-em1
Device=em1
Type=ethernet
Bridge= "Br0"
Onboot=yes
Nm_controlled=yes
Bootproto=none
Hwaddr=c5:1f:46:f8:a5:20
ipaddr=10.9.9.16
Prefix=24
gateway=10.9.9.2
dns1=218.201.4.3
domain=218.201.17.2
Name= "System em1"
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/7F/3C/wKiom1cXP9-jvsmcAAAwaWLQStU221.png "title=" 5e658723-2a7a-4814-9ec5-fd8a0c241d25.png "alt=" Wkiom1cxp9-jvsmcaaawawlqstu221.png "/>
[Email protected] Network-scripts]# cp ifcfg-em1 ifcfg-br0
[email protected] network-scripts]# cat Ifcfg-br0
Device=br0
Type=bridge
Onboot=yes
Bootproto=static
Hwaddr=c5:1f:46:f8:a5:20
ipaddr=10.9.9.16
Prefix=24
gateway=10.9.9.2
dns1=218.201.4.3
domain=218.201.17.2
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/7F/3C/wKiom1cXP2yDCe-TAAAplqm9zZg428.png "title=" 345124ee-bd87-4dce-be4b-ac5785b40bf2.png "alt=" Wkiom1cxp2ydce-taaaplqm9zzg428.png "/>
#重启网卡
[email protected] network-scripts]#/etc/init.d/network restart
Shutting interface Em1:bridge BR0 does not exist!
[OK]
Shutting down loopback interface: [OK]
Bringing up loopback interface: [OK]
Bringing Up interface em1: [OK]
Bringing up interface br0:determining if IP address 10.9.9.16 are already in use for device br0 ...
[OK]
#查看网卡配置 so that the bridge adapter replaces the EM1
# ifconfig
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/7F/3A/wKioL1cXQPbA5C4BAACZXVsMB5A857.png "title=" B2e8ff55-1e75-4141-8e66-c104001199a8.png "alt=" Wkiol1cxqpba5c4baaczxvsmb5a857.png "/>
View Network Bridge
# Brctl Show
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/7F/3A/wKioL1cXQRjzLCN_AAAR0nYKPPw880.png "title=" Df11a24f-840e-42ae-8f76-596368104ad6.png "alt=" Wkiol1cxqrjzlcn_aaar0nykppw880.png "/>
The bridge adapter is configured successfully!
=============================================
Iv. installation of KVM virtual machines
Create an ISO image and a virtual machine installation directory
Mkdir-p/root/iso
Mkdir-p/DATA/KVM
Upload the ISO image file to the/root/iso directory and use the Centos-6.6-x86_64-bin-dvd1.iso
This adoption is pushed from other servers (the 100m/s,4.5g image file in the cluster intranet is passed about 40 seconds):
Scp-p30124/home/ywliyq/iso/centos-6.6-x86_64-bin-dvd1.iso [email protected]: ~
Method One: Installation of the KVM virtual machine (Xshell under the Virt-manager GUI)
Xshell cannot open Virt-manager's graphical interface,
First, installing Xshell is not possible, you need to install Xmanager
Second, after installing the Xmanager, open the Xshell, in the connection properties of tunneing, check the Forwarding X11 connection to option, you can open the Virt-manager graphical interface normally.
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/7F/3A/wKioL1cXQUrSnAdYAACc44WOErg304.png "title=" A5620506-e74a-47ac-a5e9-808c72981a36.png "alt=" Wkiol1cxqursnadyaacc44woerg304.png "/>
Use # Virt-manager to open the graphical interface when you're done
Virt-manager Building a KVM virtual machine
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/7F/3C/wKiom1cXQKbALH5oAAC3ezfxuCM100.png "title=" 603015a4-55cb-428d-a06e-083421521a13.png "alt=" Wkiom1cxqkbalh5oaac3ezfxucm100.png "/>
Name of the virtual machine to be created lamp
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/7F/3C/wKiom1cXQOuQsnwMAAC8HoQ1EmM149.png "title=" 6d23b456-1e3b-4e06-8fb9-27e12bd6b39f.png "alt=" Wkiom1cxqouqsnwmaac8hoq1emm149.png "/>
Select the path to the ISO image, and the operating system type and version
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/7F/3A/wKioL1cXQdjA_N1tAAC8UaM5EBc706.png "title=" A04b9073-2fff-4ca9-b3ef-620de87f348f.png "alt=" Wkiol1cxqdja_n1taac8uam5ebc706.png "/>
Allocating memory for virtual machines and the number of cores for Vcpus
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/7F/3C/wKiom1cXQTTQpZT5AACh-NhIIaA747.png "title=" 2d09dcf3-ce0c-42a6-9ed7-64e918f4a99e.png "alt=" Wkiom1cxqttqpzt5aach-nhiiaa747.png "/>
Create a virtual machine image file
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/7F/3D/wKiom1cXQy-Rvb1SAAEQCKcSeng558.png "title=" C7bb4ef4-817d-400f-8f56-32bba398feff.png "alt=" Wkiom1cxqy-rvb1saaeqckcseng558.png "/> allocate the initial size of the image file, Qcow2 features automatic expansion of space capacity
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/7F/3A/wKioL1cXRCmCq2xwAACqVUy7yIU785.png "title=" F80667c5-04f9-4f67-a442-5773e59f2fce.png "alt=" Wkiol1cxrcmcq2xwaacqvuy7yiu785.png "/>
Set up a network bridge, check the pre-installation custom configuration
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/7F/3A/wKioL1cXRE2A9bPwAADftWvZmG8491.png "title=" B9ba27d8-0c86-4a05-b61b-2374b3aafee4.png "alt=" Wkiol1cxre2a9bpwaadftwvzmg8491.png "/>
Set up a virtual machine to boot from
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/7F/3A/wKioL1cXRGSCAxnGAAFrKitT2Gs742.png "title=" 2c5cfb83-8677-4b98-a2c5-3a6d2a565d34.png "alt=" Wkiol1cxrgscaxngaafrkitt2gs742.png "/>
modifying bridged network types
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/7F/3A/wKioL1cXRIzjRuFwAAFanN4Q-to752.png "title=" B40d633d-0e70-43c0-a9f5-50c7e681afb0.png "alt=" Wkiol1cxrizjrufwaafann4q-to752.png "/>
Note: After entering the installation interface, there will be a confusion of keyboard layout, the following is the workaround:
The keyboard confusion solution when KVM remotely manages guest machines via Virt-manager
First, Virt-manager Way (recommended)
If you want to avoid this, add a field to the keyboard layout when you use the Virt-install installation
--keymap=en-us
In the state of the virtual machine shutdown, select the appropriate virtual machine via the Virt-manager interface:
Open-->details-->display vnc-->keymap-->en-us
Save and then start the virtual machine.
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/7F/3D/wKiom1cXQ_qxq2FxAADf8zHbOFc086.jpg "title=" C32cc72b-2f15-4a1d-a874-1d2b02a37b16.jpg "alt=" Wkiom1cxq_qxq2fxaadf8zhbofc086.jpg "/>
Second, the command line mode
Close the virtual machine that you want to adjust, edit the virtual machine configuration file
#virsh edit ' your VM name '
Locate the following fields in the configuration file:
<graphics type= ' vnc ' port= '-1 '/>
After adding the language layout of the keyboard as follows:
<graphics type= ' vnc ' port= '-1 ' keymap= ' en-us '/>
After saving exits, reload the virtual machine configuration file
#virsh create/etc/libvirt/qemu/' your VM name '. xml
Configuration modifications finish starting the virtual machine
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/7F/3B/wKioL1cXRN2DdKPIAAC_8JINb7c081.png "title=" 9c6e273d-a70b-4261-ae42-8340ac2f21c8.png "alt=" Wkiol1cxrn2ddkpiaac_8jinb7c081.png "/>
Start the installation and automatically enter the installation interface
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/7F/3B/wKioL1cXRQTQ87xdAAeZITjoDUo159.png "title=" 3de237d7-32ab-4c0d-9a8c-266e4ec49358.png "alt=" Wkiol1cxrqtq87xdaaezitjoduo159.png "/>
And then the usual way of installation.
After the system is completed, the corresponding basic optimization needs to be done
This article is from the "Linux operations self-cultivation" blog, please be sure to keep this source http://ywliyq.blog.51cto.com/11433965/1765882
Dell R820 KVM Virtualization Deployment III (centos6.6 KVM Virtualization Deployment) in the production environment