[Share Experiences] 在deepin上安装 qemu 及 virt-manager
Tofloor
poster avatar
yanbowen
deepin
Community Developer
2025-07-01 13:13
Author

之前一直在使用 Virtualbox ,其功能强大、易于使用,能够满足需求。但最近了解到 qemu 的性能较之前有了比较大的提升,且可支持 virtio 和 spice ,故来尝试一番。

安装

sudo apt update
# Qemu
sudo apt install virt-manager virt-viewer virtinst libvirt-clients libvirt-daemon \
                 libvirt-daemon-driver-qemu libvirt-daemon-system-systemd qemu-system-gui \
                 qemu-system-modules-opengl qemu-system-x86 qemu-utils libvirt-daemon-system
# EFI & TPM
sudo apt install ovmf swtpm-tools swtpm
# Spice
sudo apt install qemu-system-modules-spice spice-client-gtk gir1.2-spiceclientgtk-3.0

运行

安装完成后,就可在启动器中看到虚拟系统管理器(Virtual Machine Manager),点击启动。

然后点击加号,创建虚拟机,按照引导进行配置,需要注意的地方包括:

  • 概况:固件中可以选择从UEFI启动。如果启动时提示找不到固件,可以换用其他的固件
  • 引导选项:如果使用本地 ISO 引导安装,需要勾选 CDROM
  • SATA CDROM:检查是否选择了引导介质
  • NIC:网络源选择 default NAT,设备型号选择 virtio 。如果设备的网卡支持桥接,可以在网络源中选择桥接
  • 显示协议 Spice:类型选择Spice,监听类型选择无,勾选 OpenGL
  • 显卡 Virtio:型号选择 Virtio ,勾选 3D 加速

然后就可启动虚拟机,进行安装了,安装完成后不要忘记取消 SATA CDROM 中引导介质。

FAQ

启动虚拟机时提示 default NAT 未创建?

这是因为虚拟网络没有默认激活,可通过:

  • sudo virsh net-list --all 查看网络状态
  • 通过 sudo virsh net-start 启动网络
  • 通过 sudo virsh net-autostart 设置网络自启

在执行 sudo virsh net-start default && sudo virsh net-autostart default 后,启动虚拟机就不会报网络错误了。

Reply Favorite View the author
All Replies
jjcui8595
deepin
Resources Team
2025-07-01 13:29
#1

like

Reply View the author
tacat
deepin
2025-07-01 13:48
#2

曾经沧海难为水,除却qemu不是虚

好久不用vbox了

Reply View the author
叁陆玖
deepin
2025-07-01 15:09
#3

agree like

Reply View the author
babyfengfjx
Super Moderator
CQA
2025-07-01 16:17
#4

好帖好帖!

目前25上virtualbox安装系统仓库的版本还是可以用的,有的同学可能装了官方或者之前商店的版本是没法用。

系统仓库的安装方法:

sudo apt install virtualbox-qt
Reply View the author
想念不会偷懒
deepin
2025-07-01 21:02
#5

为什么我点开始安装之后 一直是黑屏的😭
wechat_2025-07-01_210108_933.png

Reply View the author
yanbowen
deepin
Community Developer
2025-07-02 09:25
#6
想念不会偷懒

为什么我点开始安装之后 一直是黑屏的😭
wechat_2025-07-01_210108_933.png

检查下显卡、显示协议的配置是否正确

Reply View the author
邋遢真人
deepin
2025-07-02 11:08
#7
想念不会偷懒

为什么我点开始安装之后 一直是黑屏的😭
wechat_2025-07-01_210108_933.png

可别是ghost的iso镜像啊,那高低是不行的吧,我用官方镜像安装成功了,https://msdn.itellyou.cn/

Reply View the author
想念不会偷懒
deepin
2025-07-04 22:21
#8
yanbowen

检查下显卡、显示协议的配置是否正确

显卡、显示协议都按照上面您给的一样设置的

原来是不支持显卡加速 不开显卡加速就可以安装 😢 我的笔记本3050卡

为什么您的支持显卡加速呀

Reply View the author
想念不会偷懒
deepin
2025-07-04 22:22
#9
邋遢真人

可别是ghost的iso镜像啊,那高低是不行的吧,我用官方镜像安装成功了,https://msdn.itellyou.cn/

是选了显卡加速就装不了 不开显卡加速就可以安装😰

Reply View the author
与你
deepin
2025-09-29 18:03
#10

无法完成安装:'打开文件 '/usr/share/OVMF/OVMF_VARS_4M.ms.fd' 失败: 没有那个文件或目录'

Traceback (most recent call last):
File "/usr/share/virt-manager/virtManager/asyncjob.py", line 71, in cb_wrapper
callback(asyncjob, *args, **kwargs)
File "/usr/share/virt-manager/virtManager/createvm.py", line 2008, in _do_async_install
installer.start_install(guest, meter=meter)
File "/usr/share/virt-manager/virtinst/install/installer.py", line 726, in start_install
domain = self._create_guest(
^^^^^^^^^^^^^^^^^^^
File "/usr/share/virt-manager/virtinst/install/installer.py", line 667, in _create_guest
domain = self.conn.createXML(initial_xml or final_xml, 0)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/libvirt.py", line 4545, in createXML
raise libvirtError('virDomainCreateXML() failed')
libvirt.libvirtError: 打开文件 '/usr/share/OVMF/OVMF_VARS_4M.ms.fd' 失败: 没有那个文件或目录

Reply View the author
yanbowen
deepin
Community Developer
2025-10-09 13:45
#11
与你

无法完成安装:'打开文件 '/usr/share/OVMF/OVMF_VARS_4M.ms.fd' 失败: 没有那个文件或目录'

Traceback (most recent call last):
File "/usr/share/virt-manager/virtManager/asyncjob.py", line 71, in cb_wrapper
callback(asyncjob, *args, **kwargs)
File "/usr/share/virt-manager/virtManager/createvm.py", line 2008, in _do_async_install
installer.start_install(guest, meter=meter)
File "/usr/share/virt-manager/virtinst/install/installer.py", line 726, in start_install
domain = self._create_guest(
^^^^^^^^^^^^^^^^^^^
File "/usr/share/virt-manager/virtinst/install/installer.py", line 667, in _create_guest
domain = self.conn.createXML(initial_xml or final_xml, 0)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/libvirt.py", line 4545, in createXML
raise libvirtError('virDomainCreateXML() failed')
libvirt.libvirtError: 打开文件 '/usr/share/OVMF/OVMF_VARS_4M.ms.fd' 失败: 没有那个文件或目录

上面写的包都安装了吗?选择 OVMF_CODE_4M.fd 试下

Reply View the author