资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

如何在CentOS7中安装配置KVM虚拟化软件-创新互联

如何在CentOS7中安装配置KVM虚拟化软件?针对这个问题,今天小编总结了这篇文章,希望能帮助更多想解决这个问题的朋友找到更加简单易行的办法。

成都创新互联是一家集网站建设,浑南企业网站建设,浑南品牌网站建设,网站定制,浑南网站建设报价,网络营销,网络优化,浑南网站推广为一体的创新建站企业,帮助传统企业提升企业形象加强企业竞争力。可充分满足这一群体相比中小企业更为丰富、高端、多元的互联网需求。同时我们时刻保持专业、时尚、前沿,时刻以成就客户成长自我,坚持不断学习、思考、沉淀、净化自己,让我们为更多的企业打造出实用型网站。

CentOS7.6虚拟化软件:
KVM是基于内核的虚拟机(Kernel-based Virtual Machine)。
QEMU软件(qemu-kvm)能够创建和管理 KVM 虚拟机。
Libvirt是一套提供了多种语言接口的API,为各种虚拟化工具提供一套方便、可靠的编程接口,不仅支持 KVM,而且支持 Xen 等其它虚拟机。
Virsh是一套基于文本的管理虚拟机的命令。
Virt-manager是一套用 python 编写的虚拟机管理图形界面。

试验机器:
CPU支持Intel VT
内存8GB以上
硬盘200GB以上

1.安装CentOS7.6组件

在安装操作系统时,选择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网络

参考其它文档,建立网桥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.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  mtu 1500
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.检查开发包

[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_64
  • lrzsz-0.12.20-36.el7.x86_64
    vim-enhanced-7.4.160-5.el7.x86_64
    gcc-gfortran-4.8.5-36.el7.x86_64
  • gcc-4.8.5-36.el7.x86_64
    [root@C76 ~]#

5.关闭防火墙及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/

发现已安装:qemu-kvm qemu-img bridge-utils
已安装网络启动pxe包 gpxe-roms-qemu,

继续安装其它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.安装虚机监控工具

[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虚拟化软件的方法了吗?如果还想学到更多技能或想了解更多相关内容,欢迎关注创新互联行业资讯频道,感谢各位的阅读。

另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


分享标题:如何在CentOS7中安装配置KVM虚拟化软件-创新互联
转载来源:http://www.cdkjz.cn/article/cepece.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

大客户专线   成都:13518219792   座机:028-86922220