0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

GPUパススルーのLinuxのVMを作る

Posted at

環境

Rocky Linux 8.5
RTX 2080ti x2枚
AMD EPYC 7352 x2
memory:128GB

それぞれ1枚ずつのVMを作って開発端末とする。

VMの作成

sudo virt-install \
--name gpu3 \
--ram 8000 \
--disk path=/var/kvm/images/gpu3,size=20 \
--vcpus 4 \
--cpu host\
--os-variant centos8 \
--network bridge=br0 \
--graphics none \
--console pty,target_type=serial \
--location /tmp/Rocky-8.5-x86_64-minimal.iso \
--extra-args 'console=ttyS0,115200n8 serial' \
--host-device 01:00.0 \
--host-device 01:00.1 \
--host-device 01:00.2 \
--host-device 01:00.3 \
--features kvm_hidden=on \
--machine q35 \
--boot uefi,nvram_template=/usr/share/OVMF/OVMF_VARS.fd

ポイント

すべてのPCIeデバイスを追加すること
UEFIブートが必須で、かつSecure bootは無効化すること。(ドライバが入らない)
kvm hiddenはonにしておく。
cpuのタイプも隠しておく。hostにしておく。
あらかじめブリッジを作成しておく。bridge filterも通す。

VM上での作業

通常通りにインストールをし、nvidia-driverを入れる.

sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm -y
dnf install wget kernel-devel gcc make dkms
cd /tmp/
wget https://jp.download.nvidia.com/XFree86/Linux-x86_64/510.60.02/NVIDIA-Linux-x86_64-510.60.02.run
chmod +x NVIDIA-Linux-x86_64-510.60.02.run
./NVIDIA-Linux-x86_64-510.60.02.run -dkms
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?