如何在CentOS7中安裝配置KVM虛擬化軟件?針對這個問題,今天小編總結(jié)了這篇文章,希望能幫助更多想解決這個問題的朋友找到更加簡單易行的辦法。
成都創(chuàng)新互聯(lián)是一家集網(wǎng)站建設,渾南企業(yè)網(wǎng)站建設,渾南品牌網(wǎng)站建設,網(wǎng)站定制,渾南網(wǎng)站建設報價,網(wǎng)絡營銷,網(wǎng)絡優(yōu)化,渾南網(wǎng)站推廣為一體的創(chuàng)新建站企業(yè),幫助傳統(tǒng)企業(yè)提升企業(yè)形象加強企業(yè)競爭力。可充分滿足這一群體相比中小企業(yè)更為豐富、高端、多元的互聯(lián)網(wǎng)需求。同時我們時刻保持專業(yè)、時尚、前沿,時刻以成就客戶成長自我,堅持不斷學習、思考、沉淀、凈化自己,讓我們?yōu)楦嗟钠髽I(yè)打造出實用型網(wǎng)站。CentOS7.6虛擬化軟件:
KVM是基于內(nèi)核的虛擬機(Kernel-based Virtual Machine)。
QEMU軟件(qemu-kvm)能夠創(chuàng)建和管理 KVM 虛擬機。
Libvirt是一套提供了多種語言接口的API,為各種虛擬化工具提供一套方便、可靠的編程接口,不僅支持 KVM,而且支持 Xen 等其它虛擬機。
Virsh是一套基于文本的管理虛擬機的命令。
Virt-manager是一套用 python 編寫的虛擬機管理圖形界面。
試驗機器:
CPU支持Intel VT
內(nèi)存8GB以上
硬盤200GB以上
1.安裝CentOS7.6組件
在安裝操作系統(tǒng)時,選擇Virtualization Host軟件中的Virtualization Platform、Compatibilty Libraries、Development Tools、System Administration Tools;
選擇GNOME Desktop軟件中的GNOME Applications。
2.檢查cpu的vmx支持
[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.檢查bridge網(wǎng)絡
參考其它文檔,建立網(wǎng)橋virbr1
[root@C76 ~]# ifconfig
virbr1: flags=4163
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.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 111 bytes 5259 (5.1 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
vlan68: flags=4163
ether e0:97:96:1b:6a:ca txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
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.檢查開發(fā)包
[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
5.關(guān)閉防火墻及selinux
systemctl stop firewalld.service
setenforce 0
6.安裝yum包
映射iso安裝盤
[root@C76 ~]# mount -t iso9660 -o loop /root/CentOS-7.6-x86_64-DVD-1810.iso /media/Centos76/
發(fā)現(xiàn)已安裝:qemu-kvm qemu-img bridge-utils
已安裝網(wǎng)絡啟動pxe包 gpxe-roms-qemu,
繼續(xù)安裝其它yum包,滿足虛機基本功能
[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 0: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 0: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 0: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 0: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 0:1.5.0-1.el7 will be installed
---> Package virt-viewer.x86_64 0:5.0-11.el7 will be installed
--> Running transaction check
---> Package gnutls-utils.x86_64 0: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 0:4.5.0-10.el7 will be installed
---> Package libvirt-daemon-config-nwfilter.x86_64 0:4.5.0-10.el7 will be installed
---> Package libvirt-daemon-driver-lxc.x86_64 0:4.5.0-10.el7 will be installed
---> Package virt-manager-common.noarch 0: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 0:3.3.29-8.el7 will be installed
---> Package python-ipaddr.noarch 0:2.1.11-1.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
======================================================================================
=================
Package Arch Version
Repository Size
======================================================================================
=================
Installing:
libvirt x86_64 4.5.0-10.el7 c7-
media 181 k
libvirt-client x86_64 4.5.0-10.el7 c7-
media 477 k
libvirt-python x86_64 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 x86_64 5.0-11.el7 c7-
media 392 k
Installing for dependencies:
gnutls-dane x86_64 3.3.29-8.el7 c7-
media 36 k
gnutls-utils x86_64 3.3.29-8.el7 c7-
media 238 k
libvirt-bash-completion x86_64 4.5.0-10.el7 c7-
media 181 k
libvirt-daemon-config-nwfilter x86_64 4.5.0-10.el7 c7-
media 188 k
libvirt-daemon-driver-lxc x86_64 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.2 M
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 0:4.5.0-10.el7 libvirt-client.x86_64 0:4.5.0-
10.el7
libvirt-python.x86_64 0:4.5.0-1.el7 qemu-kvm-tools.x86_64 10:1.5.3-
160.el7
virt-install.noarch 0:1.5.0-1.el7 virt-manager.noarch 0:1.5.0-1.el7
virt-viewer.x86_64 0:5.0-11.el7
Dependency Installed:
gnutls-dane.x86_64 0:3.3.29-8.el7 gnutls-utils.x86_64 0:3.3.29-8.el7
libvirt-bash-completion.x86_64 0:4.5.0-10.el7 libvirt-daemon-config-
nwfilter.x86_64 0:4.5.0-10.el7
libvirt-daemon-driver-lxc.x86_64 0:4.5.0-10.el7 python-ipaddr.noarch 0:2.1.11-1.el7
virt-manager-common.noarch 0: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 10:2.12.0-2.el7 @anaconda
qemu-img.x86_64 10:1.5.3-160.el7 @anaconda
qemu-kvm.x86_64 10:1.5.3-160.el7 @anaconda
qemu-kvm-common.x86_64 10:1.5.3-160.el7 @anaconda
qemu-kvm-tools.x86_64 10: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 1:6.1.6-6.el7 c7-media
[root@C76 ~]#
7.設置自動啟動
[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 ~]#
建立vm-data目錄
[root@C76 ~]# mkdir -p /vm-data/iso
[root@C76 ~]# mkdir -p /vm-data/vm-image
8.安裝虛機監(jiān)控工具
[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.安裝虛機磁盤鏡像工具集和電源管理接口
[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 1:1.38.2-12.el7 @c7-media
libguestfs-tools.noarch 1:1.38.2-12.el7 @c7-media
libguestfs-tools-c.x86_64 1:1.38.2-12.el7 @c7-media
libguestfs-inspect-icons.noarch 1:1.38.2-12.el7 c7-media
libguestfs-java.x86_64 1:1.38.2-12.el7 c7-media
[root@C76 images]#
// virt- 命令從12個增加到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]#
看完這篇文章,你們學會在CentOS7中安裝配置KVM虛擬化軟件的方法了嗎?如果還想學到更多技能或想了解更多相關(guān)內(nèi)容,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,感謝各位的閱讀。
另外有需要云服務器可以了解下創(chuàng)新互聯(lián)cdcxhl.cn,海內(nèi)外云服務器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務器、裸金屬服務器、高防服務器、香港服務器、美國服務器、虛擬主機、免備案服務器”等云主機租用服務以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務可用性高、性價比高”等特點與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應用場景需求。