CentOS 7 安装 NVIDIA 显卡驱动
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
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)
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本