Install kvm on centos7
Since centos 7 has changed a lot from the previous version, we have tested the installation and Setup of kvm in centos 7 environment. The details are as follows.
1. Install kvm Software
Since you have installed and summarized kvm in detail before, the following steps are listed here:
- [Root @ 361way ~] # Yum-y install qemu-kvm libvirt virt-install bridge-utils
- [Root @ 361way ~] # Lsmod | grep kvm # make sure modules are loaded
- Kvm 441119 0
- [Root @ 361way ~] # Systemctl start libvirtd
- [Root @ 361way ~] # Systemctl enable libvirtd
Note: The Service Management Mode on centos7 is changed to systemctl.
2. Configure Nic bridging
By default, eth0 and eth1 are no longer installed on centos 7. The first Nic installed on my pc server is changed to enp3s0. The modification steps are no different from those on centos 6, as shown below:
- [Root @ 361way ~] # Cd/etc/sysconfig/network-scripts/
- [Root @ 361way network-scripts] # cat ifcfg-br0
- TYPE = Bridge
- BOOTPROTO = none
- DEVICE = br0
- ONBOOT = yes
- IPADDR0 = 192.168.0.102
- PREFIX0 = 24
- GATEWAY0 = 192.168.0.1
- [Root @ 361way network-scripts] # cat ifcfg-enp3s0
- DEVICE = enp3s0
- TYPE = Ethernet
- ONBOOT = yes
- BRIDGE = br0
- [Root @ 361way ~] Reboot
- [Root @ 361way network-scripts] # ifconfig
- Br0: flags = 4163 Mtu 1500
- Inet 192.168.0.102 netmask 255.255.255.0 broadcast 192.168.0.255
- Inet6 fe80: 7a24: afff: fe46: ca60 prefixlen 64 scopeid 0x20
- Ether 78: 24: af: 46: ca: 60 txqueuelen 0 (Ethernet)
- RX packets 129 bytes 14676 (14.3 KiB)
- RX errors 0 dropped 0 overruns 0 frame 0
- TX packets 148 bytes 21994 (21.4 KiB)
- TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
- Enp3s0. flags = 4163 Mtu 1500
- Ether 78: 24: af: 46: ca: 60 txqueuelen 1000 (Ethernet)
- RX packets 129 bytes 16482 (16.0 KiB)
- RX errors 0 dropped 0 overruns 0 frame 0
- TX packets 148 bytes 21994 (21.4 KiB)
- TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
- Lo: flags = 73 Mtu 65536
- Inet 127.0.0.1 netmask 255.0.0.0
- Inet6: 1 prefixlen 128 scopeid 0x10
- Loop txqueuelen 0 (Local Loopback)
- RX packets 9 bytes 728 (728.0 B)
- RX errors 0 dropped 0 overruns 0 frame 0
- TX packets 9 bytes 728 (728.0 B)
- TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
- Virbr0: flags = 4099 Mtu 1500
- Inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
- Ether a6: 88: 9f: 14: b2: 66 txqueuelen 0 (Ethernet)
- RX packets 0 bytes 0 (0.0 B)
- RX errors 0 dropped 0 overruns 0 frame 0
- TX packets 1 bytes 90 (90.0 B)
- TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
- [Root @ 361way network-scripts] # ip add show
- 1: lo: Mtu 65536 qdisc noqueue state UNKNOWN
- Link/loopback 00: 00: 00: 00: 00: 00 brd 00: 00: 00: 00: 00: 00
- Inet 127.0.0.1/8 scope host lo
- Valid_lft forever preferred_lft forever
- Inet6: 1/128 scope host
- Valid_lft forever preferred_lft forever
- 2: enp3s0: Mtu 1500 qdisc pfifo_fast master br0 state UP qlen 1000
- Link/ether 78: 24: af: 46: ca: 60 brd ff: ff
- 3: br0: Mtu 1500 qdisc noqueue state UP
- Link/ether 78: 24: af: 46: ca: 60 brd ff: ff
- Inet 192.168.0.102/24 brd 192.168.0.255 scope global br0
- Valid_lft forever preferred_lft forever
- Inet6 fe80: 7a24: afff: fe46: ca60/64 scope link
- Valid_lft forever preferred_lft forever
- 4: virbr0: Mtu 1500 qdisc noqueue state DOWN
- Link/ether a6: 88: 9f: 14: b2: 66 brd ff: ff
- Inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
- Valid_lft forever preferred_lft forever
Note: Because the ip command is a tool in the iproute2 software package, instead of the old ifconfig command, try to use new commands and toolkit to eliminate old software and tools.
Iii. selinux firewall disabled
- # Setenforce 0
- # Sed-I's/= enforcing/= disabled/G'/etc/selinux/config