centos7如何安装显卡驱动,nvidia显卡亲测有效
VooDoo视觉
2020年07月19日 10:09
收录于文集
共1篇

第一步:

先安装 gcc, kernel, kernel-devel

yum install -y gcc-c++  

yum install -y kernel-devel-3.10.0-1127.el7.x86_64

yum install -y kernel-devel(对应版本号)

否则安装显卡驱动过程中会报错: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 htey are properly configured; on red hat linux system, 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.

第二步:

屏蔽默认的nouveau驱动,这是非nvidia官方的驱动,由linux爱好者修改版本,所以兼容性很糟糕,居然不支持1024P以上分辨率,而且无法全屏,只能一半屏幕显示,倒:(

其实centos sudo可以不要,但sudo好处是可以命令补全。

cd /lib/modprobe.d/ sudo vim dist-blacklist.conf

打开dist-blacklist.conf配置文件

将nvidiafb注释掉 #blacklist nvidiafb 然后添加以下语句: blacklist nouveau options nouveau modeset=0 保存

 2)接着给当前镜像做备份       sudo  mv /boot/initramfs-$(uname -r).img   /boot/initramfs-$(uname -r).img.bak 3)建立新的镜像      sudo  dracut  /boot/initramfs-$(uname -r).img   $(uname -r)

重新启动centos系统 reboot 查看nouveau是否已经禁用 lsmod | grep nouveau 如果没有显示相关的内容,说明已禁用。

进入下载的驱动所在目录 执行之前先让.run文件有可执行权限: chmod u+x NVIDIA-Linux-x86_64-415.13.run 执行安装脚本: ./NVIDIA-Linux-x86_64-340.108.run --kernel-source-path=/usr/src/kernels/3.10.0-1127.el7.x86_64

记得把上面的内核版本改为自己系统的,按安装提示进行安装就可以了。

如果失败,一般是驱动版本不支持新版的linux系统,卸载掉显卡驱动: ./NVIDIA-Linux-x86_64-340.108.run  --uninstall 做完这个步骤 重启reboot