Centos

如何在 CentOS 核心 4.18.0 上安裝 NVIDIA 驅動程序

  • January 22, 2021

當我嘗試在核心 4.18.0 的 CentOS 8 上安裝 NVIDIA 驅動程序時,我在日誌文件中收到以下錯誤:

error: implicit declaration of function 'drm_pci_init';

我將從頭開始。首先,您必須安裝開發人員包和其他一些包:

dnf groupinstall "Development Tools"
dnf install libglvnd-devel elfutils-libelf-devel

然後禁用 nuveau-driver(如果已安裝)

grub2-editenv - set "$(grub2-editenv - list | grep kernelopts) nouveau.modeset=0"

您還可以一起刪除驅動程序包:

dnf remove xorg-x11-drv-nouveau

現在重新啟動到命令行。X11 和所有使用 OpenGL 的東西都不能執行。

您必須下載有更新檔的舊驅動程序。就我而言,最新版本是 v108,但您需要 v107。通過 NVIDIA 首頁或使用 wget 獲取它:

# Download the driver
wget https://de.download.nvidia.com/XFree86/Linux-x86_64/340.107/NVIDIA-Linux-x86_64-340.107.run
# Unpack the driver, do not install
bash NVIDIA-Linux-x86_64-340.107.run --extract-only
cd NVIDIA-Linux-x86_64-340.107/
# Get the patch from pastebin, or the NVIDIA developer forum (link below)
wget https://pastebin.com/raw/qsqxsBmZ -O patch_340.107.diff
# Apply the patch to the 
patch -l -p0 < patch_340.107.diff

# If you have another kernel version of course you have to change the path accordingly
./nvidia-installer -a --kernel-source-path /usr/src/kernels/4.18.0-240.10.1.el8_3.x86_64/

該更新檔來自此論壇條目:https ://forums.developer.nvidia.com/t/solved-nvidia-340-107-linux-5-0-rc5-failed-to-build-kernel-module/70277

引用自:https://unix.stackexchange.com/questions/630393