1.先安装kvm虚拟机所需的包
sudo apt install qemu-utils qemu-kvm libvirt-clients libvirt-daemon-system virt-manager virtiofsd
2.设置虚拟网络开机自启,并给当前用户授权
sudo virsh net-start default
sudo virsh net-autostart default
sudo sed -i "s/#user = "root"/user = "$(id -un)"/g" /etc/libvirt/qemu.conf
sudo sed -i "s/#group = "root"/group = "$(id -gn)"/g" /etc/libvirt/qemu.conf
sudo usermod -a -G kvm $(id -un)
sudo usermod -a -G libvirt $(id -un)
sudo systemctl restart libvirtd
sudo ln -s /etc/apparmor.d/usr.sbin.libvirtd /etc/apparmor.d/disable/
3.使用virt-manager按步骤创建虚拟机并安装镜像
启用共享内存,磁盘设置为VirtIO,虚拟网络设置virtio,显卡设置Virtio
如有需要可以再添加文件系统,设置驱动为virtiofs让宿主机和虚拟机共享文件