KVM软件安装
首先你的Linux操作系统得带有图形化界面
虚拟机开启硬件虚拟化
- 关闭防火墙和selinux
[root@server-d ~]# systemctl stop firewalld
[root@server-d ~]# systemctl disable firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@server-d ~]# vim /etc/sysconfig/selinux
[root@server-d ~]# cat /etc/sysconfig/selinux
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
[root@server-d ~]# setenforce 0
- 查看cpu是否支持VT(虚拟化)技术
cat /proc/cpuinfo | grep -E 'vmx|svm'
- 清理环境:卸载KVM
yum remove `rpm -qa | egrep 'qemu|virt|KVM'` -y
rm -rf /var/lib/libvirt/ /etc/libvirt/
- 安装软件(CentOS7)
yum install *qemu* *virt* librbdi-devel -y
- 启动服务,并查看KVM模块加载
[root@server-d ~]# systemctl start libvirtd
[root@server-d ~]# systemctl enable libvirtd
[root@server-d ~]# lsmod |grep kvm
kvm_intel 188793 0
kvm 653928 1 kvm_intel
irqbypass 13503 1 kvm
Guest OS图形模式安装
yum install -y cockpit
systemctl start cockpit
查看端口
[root@server-d ~]# netstat -lntp | grep 9090
tcp6 0 0 :::9090 :::* LISTEN 1/systemd
查看你主机ip,浏览器访问页面
关闭cockpit
[root@server-d ~]# systemctl stop cockpit.socket
[root@server-d ~]# netstat -nltp
- 上传镜像文件至你自己选择任意目录下
[root@server-d ~]# ls
anaconda-ks.cfg initial-setup-ks.cfg 模板 图片 下载 桌面
CentOS-7-x86_64-DVD-1810.iso 公共 视频 文档 音乐
virt-manager
-
弹出界面
-
安装虚拟机,选择本地安装
- 选择你上传上来的镜像文件
按照步骤后面可以默认不变
然后按照安装虚拟机步骤进行即可