In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
How to install and configure KVM virtualization software in CentOS7? In response to this problem, the editor summed up this article today, hoping to help more friends who want to solve this problem to find a more simple and feasible way.
CentOS7.6 Virtualization Software:
KVM is a kernel-based virtual machine (Kernel-based Virtual Machine).
QEMU software (qemu-kvm) can create and manage KVM virtual machines.
Libvirt is a set of API that provides multiple language interfaces, which provides a set of convenient and reliable programming interfaces for various virtualization tools. It supports not only KVM, but also other virtual machines such as Xen.
Virsh is a set of text-based commands for managing virtual machines.
Virt-manager is a set of virtual machine management graphical interface written in python.
Test machine:
CPU supports Intel VT
Memory 8GB or above
Hard disk 200GB or above
1. Install CentOS7.6 components
When installing the operating system, select Virtualization Platform, Compatibilty Libraries, Development Tools, System Administration Tools in the Virtualization Host software
Select GNOME Applications in the GNOME Desktop software.
two。 Check vmx support for cpu
[root@C76 ~] # cat / proc/cpuinfo | grep vmx
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm epb ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms xsaveopt dtherm ida arat pln pts spec_ctrl intel_stibp flush_l1d
...
3. Check the bridge network
Refer to other documents to establish a bridge virbr1
[root@C76 ~] # ifconfig
Virbr1: flags=4163 mtu 1500
Inet 192.168.68.121 netmask 255.255.255.0 broadcast 192.168.68.255
Inet6 fe80::1c7d:6fff:fe72:9884 prefixlen 64 scopeid 0x20
Ether e0:97:96:1b:6a:ca txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 111bytes 5259 (5.1KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Vlan68: flags=4163 mtu 1500
Ether e0:97:96:1b:6a:ca txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 5298 bytes 274446 (268.0 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
4. Check the development package
[root@C76 ~] # rpm-qa | grep-E "lrzsz | gcc | vim"
Vim-common-7.4.160-5.el7.x86_64
Vim-minimal-7.4.160-5.el7.x86_64
Gcc-c++-4.8.5-36.el7.x86_64
Vim-filesystem-7.4.160-5.el7.x86_64
Libgcc-4.8.5-36.el7.x86_64lrzsz-0.12.20-36.el7.x86_64
Vim-enhanced-7.4.160-5.el7.x86_64
Gcc-gfortran-4.8.5-36.el7.x86_64gcc-4.8.5-36.el7.x86_64
[root@C76 ~] #
5. Turn off the firewall and selinux
Systemctl stop firewalld.service
Setenforce 0
6. Install the Yum package
Map iso installation disk
[root@C76] # mount-t iso9660-o loop / root/CentOS-7.6-x86_64-DVD-1810.iso / media/Centos76/
Found installed: qemu-kvm qemu-img bridge-utils
Installed the network startup pxe package gpxe-roms-qemu
Continue to install other yum packages to meet the basic functions of virtual machines
[root@C76 yum.repos.d] # yum-y install qemu-kvm-tools virt-manager libvirt libvirt-python libvirt-client virt-viewer virt-install
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Resolving Dependencies
-> Running transaction check
-> Package libvirt.x86_64 0RU 4.5.0-10.el7 will be installed
-- > Processing Dependency: libvirt-daemon-driver-lxc = 4.5.0-10.el7 for package:
Libvirt-4.5.0-10.el7.x86_64
-- > Processing Dependency: libvirt-daemon-config-nwfilter = 4.5.0-10.el7 for package:
Libvirt-4.5.0-10.el7.x86_64
-> Package libvirt-client.x86_64 0RU 4.5.0-10.el7 will be installed
-- > Processing Dependency: libvirt-bash-completion = 4.5.0-10.el7 for package:
Libvirt-client-4.5.0-10.el7.x86_64
-- > Processing Dependency: gnutls-utils for package: libvirt-client-4.5.0-
10.el7.x86_64
-> Package libvirt-python.x86_64 0RU 4.5.0-1.el7 will be installed
-> Package qemu-kvm-tools.x86_64 10 1.5.3-160.el7 will be installed
-> Package virt-install.noarch 0RU 1.5.0-1.el7 will be installed
-- > Processing Dependency: virt-manager-common = 1.5.0-1.el7 for package: virt-
Install-1.5.0-1.el7.noarch
-> Package virt-manager.noarch 0RU 1.5.0-1.el7 will be installed
-> Package virt-viewer.x86_64 0vv5.0-11.el7 will be installed
-> Running transaction check
-> Package gnutls-utils.x86_64 0RU 3.3.29-8.el7 will be installed
-> Processing Dependency: gnutls-dane (x86-64) = 3.3.29-8.el7 for package: gnutls-
Utils-3.3.29-8.el7.x86_64
-> Processing Dependency: libgnutls-dane.so.0 (DANE_0_0) (64bit) for package: gnutls-
Utils-3.3.29-8.el7.x86_64
-- > Processing Dependency: libgnutls-dane.so.0 () (64bit) for package: gnutls-utils-
3.3.29-8.el7.x86_64
-> Package libvirt-bash-completion.x86_64 0RU 4.5.0-10.el7 will be installed
-> Package libvirt-daemon-config-nwfilter.x86_64 0RU 4.5.0-10.el7 will be installed
-> Package libvirt-daemon-driver-lxc.x86_64 0RU 4.5.0-10.el7 will be installed
-> Package virt-manager-common.noarch 0RU 1.5.0-1.el7 will be installed
-- > Processing Dependency: python-ipaddr for package: virt-manager-common-1.5.0-
1.el7.noarch
-> Running transaction check
-> Package gnutls-dane.x86_64 0RU 3.3.29-8.el7 will be installed
-> Package python-ipaddr.noarch 0RU 2.1.11-1.el7 will be installed
-> Finished Dependency Resolution
Dependencies Resolved
=
=
Package Arch Version
Repository Size
=
=
Installing:
Libvirt x86164 4.5.0-10.el7 c7-
Media 181 k
Libvirt-client x86164 4.5.0-10.el7 c7-
Media 477 k
Libvirt-python x86164 4.5.0-1.el7 c7-
Media 343 k
Qemu-kvm-tools x86'64 10 1.5.3-160.el7 c7-
Media 230 k
Virt-install noarch 1.5.0-1.el7 c7-
Media 94 k
Virt-manager noarch 1.5.0-1.el7 c7-
Media 657 k
Virt-viewer x8631 64 5.0-11.el7 c7-
Media 392 k
Installing for dependencies:
Gnutls-dane x8631 64 3.3.29-8.el7 c7-
Media 36 k
Gnutls-utils x8631 64 3.3.29-8.el7 c7-
Media 238 k
Libvirt-bash-completion x86164 4.5.0-10.el7 c7-
Media 181 k
Libvirt-daemon-config-nwfilter x86164 4.5.0-10.el7 c7-
Media 188 k
Libvirt-daemon-driver-lxc x86164 4.5.0-10.el7 c7-
Media 313 k
Python-ipaddr noarch 2.1.11-1.el7 c7-
Media 35 k
Virt-manager-common noarch 1.5.0-1.el7 c7-media 1.2m
Transaction Summary
=
=
Install 7 Packages (+ 7 Dependent packages)
Total download size: 4.5 M
Installed size: 15 M
Downloading packages:
Total 123 MB/s | 4.5
MB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
Installing: libvirt-bash-completion-4.5.0-10.el7.x86_64
1/14
Installing: libvirt-daemon-config-nwfilter-4.5.0-10.el7.x86_64
2/14
Installing: libvirt-python-4.5.0-1.el7.x86_64
3/14
Installing: libvirt-daemon-driver-lxc-4.5.0-10.el7.x86_64
4/14
Installing: gnutls-dane-3.3.29-8.el7.x86_64
5/14
Installing: gnutls-utils-3.3.29-8.el7.x86_64
6/14
Installing: libvirt-client-4.5.0-10.el7.x86_64
7/14
Installing: python-ipaddr-2.1.11-1.el7.noarch
8/14
Installing: virt-manager-common-1.5.0-1.el7.noarch
9/14
Installing: virt-install-1.5.0-1.el7.noarch
10/14
Installing: virt-manager-1.5.0-1.el7.noarch
11/14
Installing: libvirt-4.5.0-10.el7.x86_64
12/14
Installing: virt-viewer-5.0-11.el7.x86_64
13/14
Installing: 10:qemu-kvm-tools-1.5.3-160.el7.x86_64
14/14
Verifying: 10:qemu-kvm-tools-1.5.3-160.el7.x86_64
1/14
Verifying: python-ipaddr-2.1.11-1.el7.noarch
2/14
Verifying: gnutls-dane-3.3.29-8.el7.x86_64
3/14
Verifying: libvirt-daemon-driver-lxc-4.5.0-10.el7.x86_64
4/14
Verifying: libvirt-4.5.0-10.el7.x86_64
5/14
Verifying: libvirt-python-4.5.0-1.el7.x86_64
6/14
Verifying: virt-install-1.5.0-1.el7.noarch
7/14
Verifying: virt-viewer-5.0-11.el7.x86_64
8/14
Verifying: libvirt-client-4.5.0-10.el7.x86_64
9/14
Verifying: libvirt-daemon-config-nwfilter-4.5.0-10.el7.x86_64
10/14
Verifying: virt-manager-1.5.0-1.el7.noarch
11/14
Verifying: virt-manager-common-1.5.0-1.el7.noarch
12/14
Verifying: libvirt-bash-completion-4.5.0-10.el7.x86_64
13/14
Verifying: gnutls-utils-3.3.29-8.el7.x86_64
14/14
Installed:
Libvirt.x86_64 0RO 4.5.0-10.el7 libvirt-client.x86_64 0RO 4.5.0-
10.el7
Libvirt-python.x86_64 0v4. 5. 0-1.el7 qemu-kvm-tools.x86_64 10 1. 5. 3-
160.el7
Virt-install.noarch 0vl 1.5.0-1.el7 virt-manager.noarch 0vl 1.5.0-1.el7
Virt-viewer.x86_64 0RO 5.0-11.el7
Dependency Installed:
Gnutls-dane.x86_64 0VOR 3.3.29-8.el7 gnutls-utils.x86_64 0RU 3.3.29-8.el7
Libvirt-bash-completion.x86_64 0RO 4.5.0-10.el7 libvirt-daemon-config-
Nwfilter.x86_64 0RO 4.5.0-10.el7
Libvirt-daemon-driver-lxc.x86_64 0VO 4.5.0-10.el7 python-ipaddr.noarch 0RO 2.1.11-1.el7
Virt-manager-common.noarch 0RO 1.5.0-1.el7
Complete!
[root@C76 yum.repos.d] #
/ /
[root@C76 ~] # yum list | grep-E "kvm | qemu | virt | bridge" | grep-v daemon
Bridge-utils.x86_64 1.5-9.el7 @ anaconda
Ipxe-roms-qemu.noarch 20170123-1.git4e85b27.el7_4.1 @ anaconda
Libgovirt.x86_64 0.3.4-1.el7 @ anaconda
Libvirt.x86_64 4.5.0-10.el7 @ c7-media
Libvirt-bash-completion.x86_64 4.5.0-10.el7 @ c7-media
Libvirt-client.x86_64 4.5.0-10.el7 @ c7-media
Libvirt-gconfig.x86_64 1.0.0-1.el7 @ anaconda
Libvirt-glib.x86_64 1.0.0-1.el7 @ anaconda
Libvirt-gobject.x86_64 1.0.0-1.el7 @ anaconda
Libvirt-libs.x86_64 4.5.0-10.el7 @ anaconda
Libvirt-python.x86_64 4.5.0-1.el7 @ c7-media
Qemu-guest-agent.x86_64 10VR 2.12.0-2.el7 @ anaconda
Qemu-img.x86_64 10 anaconda 1.5.3-160.el7 @ anaconda
Qemu-kvm.x86_64 10 anaconda 1.5.3-160.el7 @ anaconda
Qemu-kvm-common.x86_64 10 anaconda 1.5.3-160.el7 @ anaconda
Qemu-kvm-tools.x86_64 10 c7-media 1.5.3-160.el7 @ c7-media
Virt-install.noarch 1.5.0-1.el7 @ c7-media
Virt-manager.noarch 1.5.0-1.el7 @ c7-media
Virt-manager-common.noarch 1.5.0-1.el7 @ c7-media
Virt-viewer.x86_64 5.0-11.el7 @ c7-media
Virt-what.x86_64 1.18-4.el7 @ anaconda
Cockpit-bridge.x86_64 173-7.el7.centos c7-media
Fence-virt.x86_64 0.3.2-13.el7 c7-media
Fence-virtd.x86_64 0.3.2-13.el7 c7-media
Fence-virtd-libvirt.x86_64 0.3.2-13.el7 c7-media
Fence-virtd-multicast.x86_64 0.3.2-13.el7 c7-media
Fence-virtd-serial.x86_64 0.3.2-13.el7 c7-media
Libvirt-cim.x86_64 0.6.3-19.el7 c7-media
Libvirt-devel.x86_64 4.5.0-10.el7 c7-media
Libvirt-docs.x86_64 4.5.0-10.el7 c7-media
Libvirt-java.noarch 0.4.9-4.el7 c7-media
Libvirt-java-devel.noarch 0.4.9-4.el7 c7-media
Libvirt-snmp.x86_64 0.0.3-5.el7 c7-media
Pcp-pmda-kvm.x86_64 4.1.0-4.el7 c7-media
Python-virtualenv.noarch 15.1.0-2.el7 c7-media
Redland-virtuoso.x86_64 1.0.16-6.el7 c7-media
Virt-top.x86_64 1.0.8-24.el7 c7-media
Virt-who.noarch 0.22.5-1.el7 c7-media
Virtuoso-opensource.x86_64 1Rank 6.1.6-6.el7 c7-media
[root@C76 ~] #
7. Set up automatic start
[root@C76 ~] # systemctl start libvirtd
[root@C76 ~] # systemctl enable libvirtd
[root@C76 ~] # lsmod | grep kvm
Kvm_intel 183621 0
Kvm 586948 1 kvm_intel
Irqbypass 13503 1 kvm
[root@C76 ~] #
Set up a vm-data directory
[root@C76] # mkdir-p / vm-data/iso
[root@C76] # mkdir-p / vm-data/vm-image
8. Install virtual machine monitoring tools
[root@C76 iso] # yum-y install virt-top virt-who
[root@C76 iso] # virt-
Virt-clone virt-manager virt-viewer virt-who-password
Virt-host-validate virt-pki-validate virt-what virt-xml
Virt-install virt-top virt-who virt-xml-validate
[root@C76 iso] # virt-
[root@C76 images] # virsh version
Compiled against library: libvirt 4.5.0
Using library: libvirt 4.5.0
Using API: QEMU 4.5.0
Running hypervisor: QEMU 1.5.3
[root@C76 images] #
9. Install virtual disk mirroring toolset and power management interface
[root@C76 images] # yum-y install acpid
[root@C76 images] # yum-y install libguestfs-tools
[root@C76 images] # yum list | grep libguest
Libguestfs.x86_64 1purl 1.38.2-12.el7 @ c7-media
Libguestfs-tools.noarch 1purl 1.38.2-12.el7 @ c7-media
Libguestfs-tools-c.x86_64 1purl 1.38.2-12.el7 @ c7-media
Libguestfs-inspect-icons.noarch 1purl 1.38.2-12.el7 c7-media
Libguestfs-java.x86_64 1purl 1.38.2-12.el7 c7-media
[root@C76 images] #
/ / virt- commands increased from 12 to 38
[root@C76 images] # virt-
Virt-alignment-scan virt-edit virt-make-fs virt-top
Virt-builder virt-filesystems virt-manager virt-viewer
Virt-builder-repository virt-format virt-pki-validate virt-what
Virt-cat virt-get-kernel virt-rescue virt-who
Virt-clone virt-host-validate virt-resize virt-who-password
Virt-copy-in virt-index-validate virt-sparsify virt-win-reg
Virt-copy-out virt-inspector virt-sysprep virt-xml
Virt-customize virt-install virt-tail virt-xml-validate
Virt-df virt-log virt-tar-in
Virt-diff virt-ls virt-tar-out
[root@C76 images] #
After reading this article, have you learned how to install and configure KVM virtualization software in CentOS7? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel. Thank you for reading.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.