Install kvm on centos7

Source: Internet
Author: User

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:

 
  1. [Root @ 361way ~] # Yum-y install qemu-kvm libvirt virt-install bridge-utils
  2. [Root @ 361way ~] # Lsmod | grep kvm # make sure modules are loaded
  3. Kvm 441119 0
  4. [Root @ 361way ~] # Systemctl start libvirtd
  5. [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:

 
  1. [Root @ 361way ~] # Cd/etc/sysconfig/network-scripts/
  2. [Root @ 361way network-scripts] # cat ifcfg-br0
  3. TYPE = Bridge
  4. BOOTPROTO = none
  5. DEVICE = br0
  6. ONBOOT = yes
  7. IPADDR0 = 192.168.0.102
  8. PREFIX0 = 24
  9. GATEWAY0 = 192.168.0.1
  10. [Root @ 361way network-scripts] # cat ifcfg-enp3s0
  11. DEVICE = enp3s0
  12. TYPE = Ethernet
  13. ONBOOT = yes
  14. BRIDGE = br0
  15. [Root @ 361way ~] Reboot
  16. [Root @ 361way network-scripts] # ifconfig
  17. Br0: flags = 4163 Mtu 1500
  18. Inet 192.168.0.102 netmask 255.255.255.0 broadcast 192.168.0.255
  19. Inet6 fe80: 7a24: afff: fe46: ca60 prefixlen 64 scopeid 0x20
  20. Ether 78: 24: af: 46: ca: 60 txqueuelen 0 (Ethernet)
  21. RX packets 129 bytes 14676 (14.3 KiB)
  22. RX errors 0 dropped 0 overruns 0 frame 0
  23. TX packets 148 bytes 21994 (21.4 KiB)
  24. TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
  25. Enp3s0. flags = 4163 Mtu 1500
  26. Ether 78: 24: af: 46: ca: 60 txqueuelen 1000 (Ethernet)
  27. RX packets 129 bytes 16482 (16.0 KiB)
  28. RX errors 0 dropped 0 overruns 0 frame 0
  29. TX packets 148 bytes 21994 (21.4 KiB)
  30. TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
  31. Lo: flags = 73 Mtu 65536
  32. Inet 127.0.0.1 netmask 255.0.0.0
  33. Inet6: 1 prefixlen 128 scopeid 0x10
  34. Loop txqueuelen 0 (Local Loopback)
  35. RX packets 9 bytes 728 (728.0 B)
  36. RX errors 0 dropped 0 overruns 0 frame 0
  37. TX packets 9 bytes 728 (728.0 B)
  38. TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
  39. Virbr0: flags = 4099 Mtu 1500
  40. Inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
  41. Ether a6: 88: 9f: 14: b2: 66 txqueuelen 0 (Ethernet)
  42. RX packets 0 bytes 0 (0.0 B)
  43. RX errors 0 dropped 0 overruns 0 frame 0
  44. TX packets 1 bytes 90 (90.0 B)
  45. TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
  46. [Root @ 361way network-scripts] # ip add show
  47. 1: lo: Mtu 65536 qdisc noqueue state UNKNOWN
  48. Link/loopback 00: 00: 00: 00: 00: 00 brd 00: 00: 00: 00: 00: 00
  49. Inet 127.0.0.1/8 scope host lo
  50. Valid_lft forever preferred_lft forever
  51. Inet6: 1/128 scope host
  52. Valid_lft forever preferred_lft forever
  53. 2: enp3s0: Mtu 1500 qdisc pfifo_fast master br0 state UP qlen 1000
  54. Link/ether 78: 24: af: 46: ca: 60 brd ff: ff
  55. 3: br0: Mtu 1500 qdisc noqueue state UP
  56. Link/ether 78: 24: af: 46: ca: 60 brd ff: ff
  57. Inet 192.168.0.102/24 brd 192.168.0.255 scope global br0
  58. Valid_lft forever preferred_lft forever
  59. Inet6 fe80: 7a24: afff: fe46: ca60/64 scope link
  60. Valid_lft forever preferred_lft forever
  61. 4: virbr0: Mtu 1500 qdisc noqueue state DOWN
  62. Link/ether a6: 88: 9f: 14: b2: 66 brd ff: ff
  63. Inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
  64. 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

 
  1. # Setenforce 0
  2. # Sed-I's/= enforcing/= disabled/G'/etc/selinux/config

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.