在Proxmox VE 7.2 中开启vGPU_unlock,实现显卡虚拟化
一:参考7.1安装vGPU_unlock
https://foxi.buduanwang.vip/virtualization/1683.html/
二: 配置软件源
- rm /etc/apt/sources.list
- rm /etc/apt/sources.list.d/*
- echo “deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free”>>/etc/apt/sources.list
- echo “deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free”>>/etc/apt/sources.list
- echo “deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free”>>/etc/apt/sources.list
- echo “deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free”>>/etc/apt/sources.list
- echo “deb https://mirrors.tuna.tsinghua.edu.cn/proxmox/debian bullseye pve-no-subscription”>>/etc/apt/sources.list
三:安装软件包
- apt update && apt install dkms git build-essential pve-kernel-5.15 pve-headers-5.15 dkms cargo jq uuid-runtime -y
安装mdevctl
- wget -P /opt/ http://ftp.br.debian.org/debian/pool/main/m/mdevctl/mdevctl_0.81-1_all.deb
- dpkg -i /opt/mdevctl_0.81-1_all.deb
四:配置内核
- echo vfio >> /etc/modules
- echo vfio_iommu_type1 >> /etc/modules
- echo vfio_pci >> /etc/modules
- echo vfio_virqfd >> /etc/modules
- echo “blacklist nouveau” >> /etc/modprobe.d/blacklist.conf
- echo “options kvm ignore_msrs=1” > /etc/modprobe.d/kvm.conf
- update-initramfs -k all -u
五:配置引导
- #编辑grub,请不要盲目改。根据自己的环境,选择设置
- nano /etc/default/grub
- #在里面找到:
- GRUB_CMDLINE_LINUX_DEFAULT=”quiet”
- #然后修改为:
- GRUB_CMDLINE_LINUX_DEFAULT=”quiet intel_iommu=on iommu=pt”
- #如果是amd cpu请改为:
- GRUB_CMDLINE_LINUX_DEFAULT=”quiet amd_iommu=on iommu=pt”
- #更新引导
- update-grub
重新启动
六:安装驱动
下载驱动文件
- wget https://mirrors.apqa.cn/d/vGPU/vgpu_unlock/drivers/NVIDIA-Linux-x86_64-510.47.03-vgpu-kvm-custom.run -P /opt
安装驱动
- sh -c /opt/NVIDIA-Linux-x86_64-510.47.03-vgpu-kvm-custom.run –dkms
安装vgpu_unlock
- cd /opt && git clone https://github.com/mbilker/vgpu_unlock-rs.git
- cd /opt/vgpu_unlock-rs
- cargo build –release
- mkdir /etc/systemd/system/{nvidia-vgpud.service.d,nvidia-vgpu-mgr.service.d}
- echo -e “[Service]\nEnvironment=LD_PRELOAD=/opt/vgpu_unlock-rs/target/release/libvgpu_unlock_rs.so” > /etc/systemd/system/nvidia-vgpud.service.d/vgpu_unlock.conf
- echo -e “[Service]\nEnvironment=LD_PRELOAD=/opt/vgpu_unlock-rs/target/release/libvgpu_unlock_rs.so” > /etc/systemd/system/nvidia-vgpu-mgr.service.d/vgpu_unlock.conf
- systemctl daemon-reload
重启主机