Prepara el medio ambiente
1. Habilite la opción virtualizada Intel VT-x / EPT o AMD-V / RVI (V) en el procesador
2. Inicie la máquina virtual y verifique si la máquina es compatible con KVM.
3. Apague el firewall
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# setenforce 0
[root@localhost ~]#
4. Instale e inicie kvm
[root@localhost ~]# yum install -y qemu-kvm libvirt virt-install bridge-utils
[root@localhost ~]# systemctl start libvirtd
[root@localhost ~]# systemctl enable libvirtd
5. Crear archivo de almacenamiento de vista
[root@localhost ~]# qemu-img create -f raw /opt/CentOS-7-x86_64.raw 10G
Formatting '/opt/CentOS-7-x86_64.raw', fmt=raw size=10737418240
[root@localhost ~]# ls -l /opt/CentOS-7-x86_64.raw
-rw-r--r--. 1 root root 10737418240 10月 30 13:59 /opt/CentOS-7-x86_64.raw
6. Subir imagen
[root@localhost ~]# mv CentOS-7-x86_64-Minimal-2003.iso /tmp/
[root@localhost ~]# ls /tmp/
CentOS-7-x86_64-Minimal-2003.iso
7. Cree una interfaz de puente de puente físico br0
[root@localhost ~]# virsh iface-bridge ens33 br0
[root@localhost ~]# systemctl restart network
Utilice su tarjeta de red física ens33 como conmutador, utilice br0 como tarjeta de red, proporcione IP y reinicie el servicio de red
Nota: El comando puede congelarse o cometer un error, y el terminal se verá obligado a salir; espere un momento, reinicie la tarjeta de red y estará bien después de iniciar sesión
8. Instale la máquina virtual
virt-install --virt-type kvm --name CentOS-7-x86_64 --ram 1536 --cdrom=/tmp/CentOS-7-x86_64-Minimal-2003.iso --disk path=/opt/CentOS-7-x86_64.raw --network bridge=br0 --graphics vnc,listen=0.0.0.0 --noautoconsole
9. Conéctese usando VNC
10. Inicie la instalación
11. No entre en pánico cuando saldrá después de reiniciar
12. Ver el inicio en la máquina virtual.