PVE配置GPU显卡直通(亲测可用)

PVE配置GPU显卡直通(亲测可用)

1.进入网址
2.输入用户名密码
请添加图片描述

3.点击local上传镜像
请添加图片描述
请添加图片描述

4.进入命令行模式 shell
请添加图片描述

5.换源

apt install apt-transport-https ca-certificates 
nano /etc/apt/sources.list

保存并替换如下内容:

# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free

deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free

deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free

保存并退出,输入以下命令

nano /etc/apt/sources.list.d/pve-enterprise.list

用以下内容替换原代码并保存退出

deb https://mirrors.tuna.tsinghua.edu.cn/proxmox/debian bullseye pve-no-subscription

更新源文件

apt-get update

6.配置显卡直通

nano /etc/default/grub

其中一行是GRUB_CMDLINE_LINUX_DEFAULT="quiet“,修改这一行为如下内容,保存并退出

GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on iommu=pt video=efifb:off "

使用以下命令打开要修改的文件

nano /etc/modules

添加如下内容

vfio
vfio_iommu_type1
vfio_pci
vfio_virqfd

保存退出后更新服务

update-initramfs -u
update-grub

然后重启pve系统

reboot

7.创建虚拟机
自己命名虚拟机名称
请添加图片描述
选择之前上传的镜像文件
请添加图片描述
机型选择q35并开启Qemu代理
请添加图片描述
分配磁盘大小
请添加图片描述
配置CPU核心数,按照自己物理机的CPU进行分配
请添加图片描述
配置虚拟机内存,物理为32GB,这里给分配了24X1024MB的内存容量
请添加图片描述
一定要取消勾选防火墙选项
请添加图片描述
确认安装
8.添加显卡设备
请添加图片描述
在PCI设备中找到自己的GPU设备型号
请添加图片描述
然后勾选所有功能、ROM-Bar、PCI-Express复选框,点击添加
请添加图片描述

9.打开虚拟机正常换源装显卡驱动
10.重启后使用终端命令nvidia-smi测试显卡是否正常
11.添加虚拟网卡(非必要)
请添加图片描述
添加后在虚拟机的硬件中添加
请添加图片描述

猜你喜欢

转载自blog.csdn.net/yyhyoung/article/details/130708894