Kvm virtualization installation and deployment (command line/minimize), kvm virtualization platform construction, kvm virtualization technology combat, detailed explanation + error-prone points to break ~~%+++

Environmental preparation

One centos7 [hard disk bit 20G], turn off the firewall and selinux
shutdown configuration requirements

Insert picture description here

1. Check the system version

cat /etc/centos-release
  • 7.4 and above (including 7.4) support deployment

Insert picture description here

2. Verify whether the CPU supports virtualization

cat /proc/cpuinfo | egrep 'vmx|svm'
  • The words vmx and svm indicate support for KVM
    Insert picture description here

3. Disable selinux

vim /etc/sysconfig/selinux
  • 7 lines are modified as follows
    Insert picture description here

4. Install the service, start

yum install -y qemu-kvm libvirt virt-install
systemctl start libvirtd
systemctl enable libvirtd

5. Create a storage file

qemu-img create -f raw /opt/CentOS-7-x86_64.raw 10G

Insert picture description here

6. Upload image

cd /tmp/

Insert picture description here

Insert picture description here

7. Create the required network card for KVM

virsh iface-bridge ens33 br0
  • If it fails, perform the next step

8. Modify the network card

  • Contents of ens33
DEVICE=ens33
ONBOOT=yes
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
NAME=ens33
BRIDGE=br0
  • Modify the created network card br0
DEVICE="br0"
ONBOOT="yes"
TYPE="Bridge"
BOOTPROTO="dhcp"
PROXY_METHOD=none
BROWSER_ONLY=no
DEFOUTE=yes
IPV4_FAILURE_FATAL=no
NAME=br0

  • Renderings show
    Insert picture description here

Restart the network card

systemctl restart network

NIC verification

ifconfig

Insert picture description here

9. 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

Insert picture description here

10. Open vnc connection

Insert picture description here

Insert picture description here
Insert picture description here

Insert picture description here
Insert picture description here

11. Start KVM Virtual

virsh list
virsh start CentOS-7-x86_64
netstat -nlpt

Insert picture description here

12. Login, modify the network cardInsert picture description here

vim /etc/sysconfig/network-scripts/ifcfg-eth0

noboot changed to yes
Insert picture description here
Insert picture description here

  • After changing the network card, restart to verify the ip, then you can connect to xshell (easy to operate)

13. Install basic services and go online with nginx

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

Insert picture description here
Insert picture description here

  • Open the browser to verify

Guess you like

Origin blog.csdn.net/qing1912/article/details/109385078