1.5. 更新和启用 xorg(Linux 虚拟机)
在在虚拟机上使用 GPU 之前,您需要在虚拟机上更新并启用 xorg。NVIDIA 驱动程序安装应该自动执行此操作。查看 /etc/X11/xorg.conf
来检查 xorg 是否已更新并启用:
# cat /etc/X11/xorg.conf
前两行表示是否由 NVIDIA 生成。例如:
# cat /etc/X11/xorg.conf # nvidia-xconfig: X configuration file generated by nvidia-xconfig # nvidia-xconfig: version 390.87 (buildmeister@swio-display-x64-rhel04-14) Tue Aug 21 17:33:38 PDT 2018
流程
在虚拟机上,使用以下命令生成
xorg.conf
文件:# X -configure
使用以下命令,将
xorg.conf
文件复制到/etc/X11/xorg.conf
:# cp /root/xorg.conf.new /etc/X11/xorg.conf
- 重启虚拟机。
通过查看
/etc/X11/xorg.conf
来验证 xorg 是否已更新并启用:# cat /etc/X11/xorg.conf
搜索
Device
部分。您应该看到类似如下的条目:Section "Device" Identifier "Device0" Driver "nvidia" VendorName "NVIDIA Corporation" EndSection
GPU 现在分配到虚拟机。