这些天研究 Miracast,又倒腾了开发用的虚拟机,但是发现了新的东西就是 QEMU ——全宇宙最强的硬件模拟器,原来这玩意可以在Windows上跑虚拟机的。
环境部署
- msys2
- mingw-w64-qemu
- 系统iso
- Hyper-V 代替 KVM/Linux
安装
在 Msys2 Repo下载exe,安装程序
运行 Msys2 UCRT, 输入 pacman -Syu更新依赖包
输入pacman -S mingw-w64-x86_64-qemu 安装 QEMU
输入cd /ucrt/bin && ls 查看qemu的工具包
在设置中查询控制面板,找到启动或关闭Windows功能,查看Hyper-V工具是否已经安装了,没有安装并重启。

运行Msys2 UCRT,输入 qemu-img create /d/kvm/Ubuntu22.img 40G,创建40GB的磁盘空间
可以选择TCG或Hyper-V来实现CPU硬件加速,推荐Hyper-V更快(我知道有HAXE,但是Intel停止项目维护了)
# 常规安装系统(使用TCG)
$ qemu-system-x86_64w.exe -drive file=./Ubuntu22.img,index=0,media=disk,format=raw -cdrom ./ubuntu-22.04.2-desktop-amd64.iso -m 8G -smp 4 -L Bios -usbdevice mouse -usbdevice keyboard -boot menu=on -rtc base=localtime,clock=host -parallel none -serial none -name ubuntu-no-acpi -no-reboot --accel tcg,thread=multi
# Hyper-V
$ qemu-system-x86_64w.exe -drive file=./Ubuntu22.img,index=0,media=disk,format=raw -cdrom ./ubuntu-22.04.2-desktop-amd64.iso -m 8G -smp 4 -L Bios -usbdevice mouse -usbdevice keyboard -boot menu=on -rtc base=localtime,clock=host -parallel none -serial none -name ubuntu-no-acpi -no-reboot --accel whpx,kernel-irqchip=off
注意:kernel-irqchip=off不加进不了系统的,只会卡在Bios
安装完后运行系统,注意Ubuntu22.04默认sshd没有,自己需要在虚拟机里安装的
$ qemu-system-x86_64w.exe -drive file=/d/kvm/Ubuntu22.img,index=0,media=disk,format=raw -m 8G -smp 4 -L Bios -usbdevice mouse -usbdevice keyboard -boot menu=on -rtc base=localtime,clock=host -parallel none -serial none -name ubuntu -no-acpi -no-hpet -no-reboot -device e1000,netdev=user.0 -netdev user,id=user.0,hostfwd=tcp::2222-:22 --accel whpx,kernel-irqchip=off
可以通过ssh -p 2222 username@host远程访问系统
错误情况
遇到Could not set up host forwarding rule这个问题,我查了不少文献,但是都回答得模棱两可,建议直接重启电脑,我就重启后又正常了。














![[AI语音克隆] 5秒内克隆您的声音并生成任意语音内容](https://img-blog.csdnimg.cn/6ba6098992f54511a193d114d7083c6d.png)




