It is recommended to use the qcow2 disk format for the KVM virtual machine of CentOS 7. This experiment installs the CentOS 6.8 64 virtual machine in the KVM.
Use winscp to upload to /data/iso/
1 virt-install --network bridge=br0,model=virtio --name=vm01-centos6.8--ram=1024--vcpus=2--disk path=/data/images/vm01-centos6.8.img,size=20,bus=virtio --cdrom /data/iso/CentOS-6.8-x86_64-bin-DVD1.iso --vnc --vncport=5902--vnclisten=0.0.0.0--noautoconsole --accelerate
Parameter Description:
win7:MicrosoftWindows7
vista:MicrosoftWindowsVista
winxp64:MicrosoftWindowsXP(x86_64)
winxp:MicrosoftWindowsXP
win2k8:MicrosoftWindowsServer2008
win2k3:MicrosoftWindowsServer2003
freebsd8:FreeBSD8.x
generic:Generic
debiansqueeze:DebianSqueeze
debianlenny:DebianLenny
fedora16:Fedora16
fedora15:Fedora15
fedora14:Fedora14
mes5.1:MandrivaEnterpriseServer5.1andlater
mandriva2010:MandrivaLinux2010andlater
rhel6:RedHatEnterpriseLinux6
rhel5.4:RedHatEnterpriseLinux5.4orlater
rhel4:RedHatEnterpriseLinux4
sles11:SuseLinuxEnterpriseServer11
sles10:SuseLinuxEnterpriseServer
ubuntuoneiric:Ubuntu11.10(OneiricOcelot)
ubuntunatty:Ubuntu11.04(NattyNarwhal)
ubuntumaverick:Ubuntu10.10(MaverickMeerkat)
ubuntulucid:Ubuntu10.04(LucidLynx)
ubuntuhardy:Ubuntu8.04LTS(HardyHeron)
1[ root@kvm-host qemu]# virt-manager
The installation process is slightly
1[ root@kvm-host ~]# virsh list --all
2 Id Name State
3- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 4- vm01-centos6.8 shut off
5[ root@kvm-host ~]# virsh start vm01-centos6.8
In the graphical interface, use virt-manager to log in from the graphical interface.
1[ root@kvm-host ~]# virsh console vm01-centos6.8
It is possible that the kvm virtual machine has only the lo network card after logging in, but not eth0.
Need to be executed in the kvm virtual machine-
1 vi /etc/sysconfig/network-scripts/ifcfg-eth0
2 DEVICE=eth0
3 HWADDR=52:54:00:cd:4e:34 #It needs to be always in the xml configuration file of kvm and is globally unique.
4 ONBOOT=yes #boot
5 NM_CONTROLLED=yes
6 BOOTPROTO=dhcp
7 Tip: If DHCP exists in the LAN, it can be turned on. If not, it can be configured with a static IP in the same network segment as the host.
8 # ifconfig eth0 up
9 # dhclient eth0 #Turn on the eth0 network card.
If there is a stuck, you need to modify the relevant files in the kmv virtual machine. The kvm virtual machine of CentOS7 can be solved in the following ways——
1[ root@kvm-host ~]# grubby --update-kernel=ALL --args="console=ttyS0"2 CentOS6 can be solved in the following ways-
3[ root@kvm-host ~]# echo ssyS0 >>/etc/securetty #Host/etc/securetty add ttyS0
4[ root@kvm-host ~]# echo "S0:12345:respawn:/sbin/agetty/ ttyS0 115200">>/etc/inittab
5[ root@kvm-host ~]# vi /etc/grub.conf
6 kernel /vmlinuz-2.6.32-431.el6.x86_64 ro root=/dev/mapper/VolGroup-lv_root …… rhgb quiet console=ttyS0 #Finally add console=ttyS0
Recommended Posts