CentOS7 install KVM Virtual Machine
I. Preparations
1. confirm that the machine has VT
Terminal input command:
grep '(vmx|svm)' /proc/cpuinfo
If vmx or svm is in flags, VT is supported. If no output is available, your cpu is not supported and you cannot use the KVM virtual machine.
2. Make sure that VT: Intel (R) Virtualization alization Tech [Enabled] is Enabled in the BIOS by running the following command:
lsmod | grep kvm modprobe kvm-intel
Ii. Bridging Network
With the bridge network, the virtual machine can access each other with other machines. 1. Copy the ifcfg-em1 as a ifcfg-br0 and change the ifcfg-br0 to the following Configuration
TYPE=BridgeBOOTPROTO=staticDEFROUTE=yesPEERDNS=yesPEERROUTES=yesIPV4_FAILURE_FATAL=noNAME=br0DEVICE=br0ONBOOT=yesIPADDR=192.168.1.116NETMASK=255.255.255.0GATEWAY=192.168.1.1
2. The original Nic ifcfg-em1 only retains the following configuration, others are commented out:
NAME=em1DEVICE=em1ONBOOT=yesBRIDGE=br0
3. Restart the network
service network restart
3. Install kvm
1. Install kvm
yum -y install libcanberra-gtk2 qemu-kvm.x86_64 qemu-kvm-tools.x86_64 libvirt.x86_64 libvirt-cim.x86_64 libvirt-client.x86_64 libvirt-java.noarch libvirt-python.x86_64 libiscsi-1.7.0-5.el6.x86_64 dbus-devel virt-clone tunctl virt-manager libvirt libvirt-python python-virtinst
2. Install x-windows and use the graphical interface to manage virtual machines
yum groupinstall "X Window System"
3. Install Chinese characters to solve the interface garbled characters
yum install dejavu-lgc-sans-fonts yum groupinstall "Fonts" -y
Error: 1. couldn't connect to accessibility bus failed to connect to socket/tmp/failure solution:
export NO_AT_BRIDGE=1
Iv. 1. Using virt-manager to manage virtual machines can complete cloning, installation, enabling, and disabling. For most of the operations such as ssh command logon to the server, the XC parameter must be added. If you use putty to log on to the server in windows, you must enable x-windows as follows:
Download xmingat http://sourceforge.net/projects/xming/and install and run it. Putty.exe ==> Connection/SSH/X11 ==> X11 forwarding/Enable check box, X dispaly location can be empty
2. Create a pre-allocated File
qemu-img create -f qcow2 -o preallocation=metadata /data/test.qcow2 80G
3. Enable the VM to automatically start upon startup
Virsh list -- all view Virtual Machine name and status virsh autostart + Virtual Machine name
After setting, you can see the link to the configured KVM configuration file under/etc/libvirt/qemu/autostart.