Centos7 kvm virtualization installation and use

Prepare the environment

1. Turn on the virtualization Intel VT-x/EPT or AMD-V/RVI(V) option in the processor

Insert picture description here

2. Start the virtual machine and check whether the machine supports KVM

Insert picture description here

3. Turn off the firewall

[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# setenforce 0
[root@localhost ~]# 

4. Install and start kvm

[root@localhost ~]# yum install -y qemu-kvm libvirt virt-install bridge-utils
[root@localhost ~]# systemctl start libvirtd
[root@localhost ~]# systemctl enable libvirtd

5. Create view storage file

[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. Upload image

[root@localhost ~]# mv CentOS-7-x86_64-Minimal-2003.iso /tmp/
[root@localhost ~]# ls /tmp/
CentOS-7-x86_64-Minimal-2003.iso

7. Create a physical bridge bridge interface br0

[root@localhost ~]# virsh iface-bridge ens33 br0
[root@localhost ~]# systemctl restart network

Use your physical network card ens33 as the switch, use br0 as the network card, provide IP, and restart the network service

Note: The command may freeze or make an error, and the terminal will be forced to exit; wait a while, restart the network card, and it will be OK after logging in

8. Install the virtual machine

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. Connect using VNC

Insert picture description here

Insert picture description here

10. Start the installation

Insert picture description here
Insert picture description here

11. Don't panic when it will exit after restart

Insert picture description here

12. View the startup on the virtual machine

Insert picture description here
Insert picture description here
Insert picture description here

If there is no network, please change the network card to dhcp dynamic

Insert picture description hereInsert picture description here

Guess you like

Origin blog.csdn.net/Q274948451/article/details/109383737