Lab environment: Dell r710 Linux system uses centos6.7
Memory 32G, HDD 800G
Server Host: 172.18.204.1
Kickstart file Host: 172.18.11.115
]# modprobe KVM
]# lsmod |grep KVM
You can continue as shown below:
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/83/29/wKiom1dr8dnwMSTmAAAgeKYgl7A960.png "title=" 1.png " alt= "Wkiom1dr8dnwmstmaaagekygl7a960.png"/>
Verify that the following files exist
]# ls /DEV/KVM
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/83/29/wKioL1dr8j-yv0PIAAAKwna6b0Q555.png "title=" 2.png " alt= "Wkiol1dr8j-yv0piaaakwna6b0q555.png"/>
To turn off SELinux:
]# vim /etc/sysconfig/selinux
Selinux=dsabled
]# Service NetworkManager Stop
]# Chkconfig NetworkManager off
]# yum-y Install libvirt install QEMU-KVM virt-manager virt-viewer virt-insatll qemu-kvm-tools KVM PYT Hon-virtinst
]# Service LIBVIRTD Start
]# Chkconfig LIBVIRTD on
To create a physical bridge:
]# Virsh Iface-bridge em1 br0
]# mkdir-pv/data/vms/images/test/
]# virt-install--name=centos6--os-type=linux--os-variant=rhel6--ram 1024x768--vcpus=2--disk path=/data/vms/images /test/test.img,format=qcow2,size=80,bus=virtio--accelerate--location http://172.18.0.1/ cobbler/ks_mirror/centos-6.7-x86_64/ --vnc--vnclisten=0.0.0.0--network bridge=br0,model=virtio-- Noautoconsole
]# Virt-manager
The graphics window appears:
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/83/29/wKiom1dr9VzgdGGDAAC87Iithnk432.png "title=" 3.png " alt= "Wkiom1dr9vzgdggdaac87iithnk432.png"/>
The above one virtual machine is created, in this case, the premise is that the network has Pxe+cobbler automatic installation system http://172.18.0.1/cobbler/ks_mirror/CentOS-6.7-x86_64/
On the basis of the above, you can also use the script to create the virtual machine in bulk, and provide a local kickstart installed partition file, according to the secondary file for the virtual machine automatically partition:
On 172.18.11.115:
A Web server is provided and the kickstart file can be accessed;
]# yum-y Install httpd
]# VIM/VAR/WWW/HTML/CENTOS6
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/83/29/wKioL1dr99Hitp8FAAB9b4jrLRk495.png "style=" width : 740px;height:532px; "title=" 4.png "width=" 740 "height=" 532 "border=" 0 "hspace=" 0 "vspace=" 0 "alt=" Wkiol1dr99hitp8faab9b4jrlrk495.png "/>
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/83/29/wKiom1dr99LzNhsRAAApKRiBoYI008.png "style=" float: none; "title=" 5.png "alt=" Wkiom1dr99lznhsraaapkriboyi008.png "/>
]# Vim createvm.sh
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/83/29/wKioL1dr-FWzglQEAABBAkcjchE642.png "title=" 6.png " Width= "727" height= "168" border= "0" hspace= "0" vspace= "0" style= "width:727px;height:168px;" alt= " Wkiol1dr-fwzglqeaabbakcjche642.png "/>
]# chmod +x createvm.sh
]# Bash-n createvm.sh
The example above is to create 8 virtual machines with the name centos6-24 to centos6-30, the number specified for the parameter 1 for the memory set to the number specified for the 1024,CPU number of parameters 2 to 2 cores, The kickstart file points to the file provided in the 172.18.11.115;
]# createvm.sh 1024 2
At this point, 8 virtual machines are created automatically.
Installing KVM on centos6.7, creating VMS in bulk