一. 准备工作:
系统环境:
centos 7.7

  1. 关闭selinux:
    [root@localhost ~]# setenforce 0
    *[root@localhost ~]# sed -ri 's/^(SELINUX=)./\1disabled/g' /etc/selinux/config
    [root@localhost ~]# getenforce **
    Disabled

2.关闭防火墙:
[root@localhost ~]# systemctl status firewalld
firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
Active: inactive (dead) since Tue 2020-03-03 15:04:25 CST; 3 weeks 1 days ago
Docs: man:firewalld(1)
Process: 907 ExecStart=/usr/sbin/firewalld --nofork --nopid $FIREWALLD_ARGS (code=exited, status=0/SUCCESS)
Main PID: 907 (code=exited, status=0/SUCCESS)

Mar 03 15:03:08 localhost.localdomain systemd[1]: Starting firewalld - dynamic firewall .....
Mar 03 15:03:09 localhost.localdomain systemd[1]: Started firewalld - dynamic firewall d...n.
Mar 03 15:04:23 localhost.localdomain systemd[1]: Stopping firewalld - dynamic firewall .....
Mar 03 15:04:25 localhost.localdomain systemd[1]: Stopped firewalld - dynamic firewall d...n.
Hint: Some lines were ellipsized, use -l to show in full.

3.升级yum原包:
[root@localhost ~]# yum install -y epel-release.noarch
BDB2053 Freeing read locks for locker 0x5ab: 3553/140611650713408
BDB2053 Freeing read locks for locker 0x594: 3553/140611650713408
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile

  • base: mirrors.aliyun.com
  • extras: mirrors.aliyun.com
  • updates: mirrors.163.com
    Resolving Dependencies
    --> Running transaction check
    ---> Package epel-release.noarch 0:7-11 will be installed
    --> Finished Dependency Resolution

二.安装KVM
[root@localhost ~]# yum -y install qemu-kvm qemu-kvm-tools qemu-img virt-manager libvirt libvirt-python libvirt-client virt-install virt-viewer bridge-utils libguestfs-tools
Resolving Dependencies
--> Running transaction check
---> Package libguestfs-tools.noarch 1:1.40.2-5.el7_7.3 will be installed
--> Processing Dependency: libguestfs-tools-c = 1:1.40.2-5.el7_7.3 for package: 1:libguestfs-tools-1.40.2-5.el7_7.3.noarch
--> Processing Dependency: libguestfs = 1:1.40.2-5.el7_7.3 for package: 1:libguestfs-tools-1.40.2-5.el7_7.3.noarch
--> Processing Dependency: perl(Win::Hivex) >= 1.2.7 for package: 1:libguestfs-tools-1.40.2-5.el7_7.3.noarch
--> Processing Dependency: perl(Win::Hivex::Regedit) for package: 1:libguestfs-tools-1.40.2-5.el7_7.3.noarch
--> Processing Dependency: perl(Win::Hivex) for package: 1:libguestfs-tools-1.40.2-5.el7_7.3.noarch
--> Processing Dependency: perl(Sys::Virt) for package: 1:libguestfs-tools-1.40.2-5.el7_7.3.noarch
yum软件安装注解:
qemu-kvm :为KVM虚拟机提供IO设备
libvirt :管理虚拟机
bridge-utils:网桥工具
libguestfs-tools :
virt-install :命令行的虚拟机创建安装工具
virt-manager:命令行的虚拟机创建安装管理软件
启动libvirt并添加开机启动:
[root@localhost ~]# systemctl start libvirtd
[root@localhost ~]# systemctl enable libvirtd

KVM系统安装完成!!
图形界面创建虚拟机请参考下一篇:KVM之使用virt-manager 管理工具创建虚拟机