CentOS 7系统KVM虚拟机支持UEFI启动

1、安装OVMF (Open Virtual Machine Firmware)

[root@DT_Node-172_30_200_203 ~]# cat >/etc/yum.repos.d/kraxel.repo<<EOF
# create new
[qemu-firmware-jenkins]
name=firmware for qemu, built by jenkins, fresh from git repos
baseurl=https://www.kraxel.org/repos/jenkins/
enabled=0
gpgcheck=0
EOF
yum --enablerepo=qemu-firmware-jenkins -y install OVMF

2、编辑配置文件

[root@DT_Node-172_30_200_203 ~]# vi /etc/libvirt/qemu.conf #取消下面行数的注释符
751 nvram = [                                                                                                                                                                                                                                                 
752    "/usr/share/OVMF/OVMF_CODE.fd:/usr/share/OVMF/OVMF_VARS.fd",
753    "/usr/share/OVMF/OVMF_CODE.secboot.fd:/usr/share/OVMF/OVMF_VARS.fd",
754    "/usr/share/AAVMF/AAVMF_CODE.fd:/usr/share/AAVMF/AAVMF_VARS.fd",
755    "/usr/share/AAVMF/AAVMF32_CODE.fd:/usr/share/AAVMF/AAVMF32_VARS.fd"
756 ]

3、升级QEMU

[root@DT_Node-172_30_200_203 ~]# /usr/libexec/qemu-kvm -version
QEMU emulator version 1.5.3 (qemu-kvm-1.5.3-141.el7_4.6), Copyright (c) 2003-2008 Fabrice Bellard

[root@DT_Node-172_30_200_203 ~]# yum -y install centos-release-qemu-ev

[root@DT_Node-172_30_200_203 ~]# sed -i -e "s/enabled=1/enabled=0/g" /etc/yum.repos.d/CentOS-QEMU-EV.repo
# for this installing, [qemu-kvm] package is replaced to [qemu-kvm-ev] package

[root@DT_Node-172_30_200_203 ~]# yum --enablerepo=centos-qemu-ev -y install qemu-kvm-ev
[root@DT_Node-172_30_200_203 ~]# systemctl restart libvirtd
[root@DT_Node-172_30_200_203 ~]# /usr/libexec/qemu-kvm -version
QEMU emulator version 2.12.0 (qemu-kvm-ev-2.12.0-33.1.el7_7.4)
Copyright (c) 2003-2017 Fabrice Bellard and the QEMU Project developers

4、至此我们可以创建UEFI启动的虚拟机了

[root@DT_Node-172_30_200_203 ~]# virt-install --name windows2019 \
--connect qemu:///system --arch=x86_64 \
--ram 8192 --vcpus 4 --cpu host --video cirrus \
--network network=default,model=virtio \
--features hyperv_relaxed=on,hyperv_spinlocks=on,hyperv_vapic=on \
--graphics vnc,listen=0.0.0.0 \
--boot uefi,cdrom,fd,hd,network,menu=on \
--noautoconsole --os-type windows --os-variant win2k19 \
--disk path=/data/virt/windows2019.qcow2,size=60,format=qcow2,device=disk,bus=virtio \
--disk path=/data/iso/cn_windows_server_2019_updated_march_2019_x64_dvd_c1ffb46c_VirtIO.iso,device=cdrom \
--disk path=/data/iso/USBOSV3.iso,device=cdrom \
--cdrom=/data/iso/ImageInstall.iso

5、来看看效果

CentOS 7系统KVM虚拟机支持UEFI启动

CentOS 7系统KVM虚拟机支持UEFI启动

CentOS 7系统KVM虚拟机支持UEFI启动

CentOS 7系统KVM虚拟机支持UEFI启动

CentOS 7系统KVM虚拟机支持UEFI启动

CentOS 7系统KVM虚拟机支持UEFI启动

lookback
  • 本文由 发表于 2020年3月16日15:46:19
  • 除非特殊声明,本站文章均为原创,转载请务必保留本文链接
匿名

发表评论

匿名网友 填写信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: