System Version:CentOS 7.7.1908
kernel Version:3.10.0-1062.el7.x86_64
条件
禁止 Nouveau
安装 kernel-devel 或 kernel-source、kernel-header;
安装 binutils,路径/usr/bin/ld;
1.安装依赖
yum -y install epel-release
yum -y install gcc binutils wget
yum -y install kernel-devel
2.禁用Nouveau
2.1.检查是否开启Nouveau
lsmod | grep nouveau
注意:无信息输出表示已被禁用无需在操作以下步骤;
2.2.修改配置
echo -e "blacklist nouveau\noptions nouveau modeset=0" > /etc/modprobe.d/blacklist.conf
2.3.备份img
mv /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r).img.bak
2.4.重建
dracut /boot/initramfs-$(uname -r).img $(uname -r)
2.5.重启系统
reboot
2.6.检查是否关闭
lsmod | grep nouveau
注意:无任何信息输出表示禁用成功;
3.检查驱动
3.1.安装elrepo源
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-4.el7.elrepo.noarch.rpm
或者
yum -y install https://www.elrepo.org/elrepo-release-7.0-4.el7.elrepo.noarch.rpm
3.2.安装nvidia-detect
yum -y install nvidia-detect
3.3.检测显卡驱动
nvidia-detect -v
This device requires the current 440.36 NVIDIA driver kmod-nvidia
4.驱动安装
4.1.下载驱动
wget https://us.download.nvidia.cn/XFree86/Linux-x86_64/440.36/NVIDIA-Linux-x86_64-440.36.run
注意:如果检测出来版本号与我的不一致可以自行替换红色部分;
其他版本:
wget https://us.download.nvidia.cn/XFree86/Linux-x86_64/430.40/NVIDIA-Linux-x86_64-430.40.run
wget https://us.download.nvidia.cn/XFree86/Linux-x86_64/430.40/NVIDIA-Linux-x86_64-418.56.run
4.2.授权
chmod +x NVIDIA-Linux-x86_64-440.36.run
4.3.安装
sh ./NVIDIA-Linux-x86_64-440.36.run -s
安装参数
--module-signing-secret-key=/path/to/signing.key
--module-signing-public-key=/path/to/signing.x509
4.4.查看显卡信息
nvidia-smi
注意:信息输出表示显卡驱动已经安装完成;
5.卸载驱动
5.1.卸载安装
nvidia-uninstall
5.2.清理安装
dkms remove
注意:需要安装“yum -y install dkms”
6.常见错误
1.安装时报错,以下错误内容:
ERROR: Unable to find the kernel source tree for the currently running kernel. Please make sure you have installed the kernel source files for your kernel and that they are properly configured; on
Red Hat Linux systems, for example, be sure you have the 'kernel-source' or 'kernel-devel' RPM installed. If you know the correct kernel source files are installed, you may specify the
kernel source path with the '--kernel-source-path' command line option.”
解决办法:
安装内核库
yum -y install epel-release
yum -y install kernel-devel
内核版本对比
rpm -qa |grep kernel
uname -r
安装驱动
./NVIDIA-Linux-x86_64-440.36.run --kernel-source-path=/usr/src/kernels/3.10.0-1160.42.2.el7.x86_64 -k $(uname -r)