RHEL9安装KVM
安装RHEL9系统省略,网上很多说明
KVM安装第一步
配置yum源
新安装的RHEL没有源,因此配置本地yum源
[BaseOS]
name=BaseOS
baseurl=file:///media/cdrom/BaseOS
gpgcheck=0
enabled=1
[AppStream]
name=AppStream
baseurl=file:///media/cdrom/AppStream
gpgcheck=0
enabled=1
配置好后挂载就不再说明了。
KVM安装第二步
执行命令安装软件包(参考http://www.yanjun.pro/?p=122)
dnf install qemu-kvm libvirt virt-install virt-viewer -y
安装后启动虚拟化服务
for drv in qemu network nodedev nwfilter secret storage interface; do systemctl start virt${drv}d{,-ro,-admin}.socket; done
执行命令验证安装结果[root@RHEL9 ~]# virt-host-validate
QEMU: Checking for hardware virtualization : PASS
QEMU: Checking if device /dev/kvm exists : PASS
QEMU: Checking if device /dev/kvm is accessible : PASS
QEMU: Checking if device /dev/vhost-net exists : PASS
QEMU: Checking if device /dev/net/tun exists : PASS
QEMU: Checking for cgroup 'cpu' controller support : PASS
QEMU: Checking for cgroup 'cpuacct' controller support : PASS
QEMU: Checking for cgroup 'cpuset' controller support : PASS
QEMU: Checking for cgroup 'memory' controller support : PASS
QEMU: Checking for cgroup 'devices' controller support : PASS
QEMU: Checking for cgroup 'blkio' controller support : PASS
QEMU: Checking for device assignment IOMMU support : PASS
QEMU: Checking if IOMMU is enabled by kernel : WARN (IOMMU appears to be disabled in kernel. Add intel_iommu=on to kernel cmdline arguments)
QEMU: Checking for secure guest support : WARN (Unknown if this platform has Secure Guest support)
如果出现报错:
- 如果主机 CPU 不支持 KVM 虚拟化,virt-host-validate 会输出: QEMU: Checking for hardware virtualization: FAIL (Only emulated CPUs are available,performance will be significantly limited)
则关闭虚拟机,配置虚拟化引擎如下图所示。以上报错解决
KVM虚拟机创建及管理待测试总结……………………