nvidia驱动安装流程
下载驱动
# 去官网根据显卡型号和操作系统下载对应的显卡驱动,注意操作系统类型和架构(ARM或X86)
驱动下载https://www.nvidia.cn/drivers/lookup

安装环境准备
# 检查显卡是否已经被系统识别,确认一下数量
lspci | grep -i nvidia
# 驱动安装时需要gcc、mkae等软件环境的支撑,所以要先安装,否则后续在安装时会报错
# 在安装时需要本地安装源或使用网上的安装源(如果是网上的安装源,需要服务器能上网才能安装)
yum -y install gcc gcc-c++ make vim wget curl pstree net-tools lrzsz
# 检查gcc和make是否安装成功
gcc -version
make --version
# 安装英伟达显卡之前先看系统是否有自带驱动nouveau,如果有的话最好将其禁用后再安装英伟达驱动
# centos可能会带,麒麟系统一般不带
lsmod | grep nouveau
# 禁用方法 ,在最后添加
vim /usr/lib/modprobe.d/blacklist-nouveau.conf
blacklist nouveau
options nouveau modeset=0
# 重启内核,重启服务器,再检查一次是否还有nouveau驱动
dracut -force
# 下次启动直接使用命令行模式,如果在图形界面下安装的话会提示需要关闭x-server
systemctl set-default multi-user.target
reboot
lsmod | grep nouveau
开始安装
# 安装方法一:
chmod +x xxxx.run
./xxx.run --no-opengl-files
--no-opengl-files 只安装驱动文件,不安装OpenGL文件
-no-x-check 安装时关闭X服务,在图形界面下安装时最好带此选项,否则会提示“警告”
检查
# 安装完成之后重启测试
reboot
# 重启后检查是否安装成功,有正常输出表示成功
nvidia-smi
echo $?
常见问题
# 如果在没有插入显卡前就安装驱动会提问此警告
WARNING: you do not appear to have an NVDIA GPU supported by the 545.23.06 NVIDIA linux graphics driver installed in the system. For CHIPS in the README available on the linux driver download page at www.nvida.com
警告:系统中似乎没有安装545.23.06 NVIDIA linux图形驱动程序支持的NVIDIA GPU。在linux驱动程序下载页面www.nvida.com上提供的自述文件中的CHIPS
# 如果本系统上有显卡的驱动程序(有可能是操作系统自带的集成显卡驱动),会出如下提示
# 如果决定覆盖就继续安装即可
An alternate method of installing the NVDIA driver was detected.(this is usually a package provided by your distributor.) A driver install via that method may intergrate with your system than a driver installed by vndia-installer
Please review the message provided by the maintainer of this alternate installation method and decide how ot proceed.
continue installtion
检测到安装NVDIA驱动程序的替代方法。(这通常是由您的分销商提供的软件包。)通过这种方法安装的驱动程序比通过vndia-installer安装的驱动程序更容易与您的系统集成。请查看这种替代安装方法的维护者提供的消息,并决定如何进行。继续设备
# 该驱动程序是32位,是否继续安装,选择是正常安装即可
install nvida's 32-bit compatibility libraries? yes or no?
# 询问是否在DKMS注册内核模块源吗,不需要注册
would you like to register the kernel module sources with DKMS? this will allow DKMS to automatically build a new module, if your kernel changes later?
您想要在DKMS中注册内核模块源吗?这将允许DKMS自动构建一个新的模块,如果您的内核更改以后?
# 提示缺少开发库,继续即可
# WARNING:unable to determine the path to install the libglvnd EGL vendor library config files.check that you have pkg-config and the libglvnd development libraries installed. or specify a path with --glvnd-epl-config-path
#警告:无法确定libglvnd EGL供应商库配置文件的安装路径。检查是否安装了pkg-config和libglvnd开发库。或者使用——glvnd-epl-config-path指定路径
# 是否需要更新 X 配置文件,不需要
Would you like to run the nvidia-xconfig utility to automatically update your X configuration file so that the NVIDIA X driver dill be used dhen you restart X? Any pre-existing X configuration file will be backed up
您是否希望运行NVIDIA -xconfig实用程序来自动更新X配置文件,以便在重新启动X时使用NVIDIA X驱动程序?任何预先存在的X配置文件都将被备份。
# 最后会提示安装完成
installation of the VNIDIA accelerated graphics driver for linux-x86_64 is now complete
linux-x86 64的VNIDIA加速图形驱动程序的安装现在已经完成
驱动卸载
# 显卡驱动卸载方法
/usr/bin/nvidia-uninstall
# CUDA卸载方法
/usr/local/cuda-X.Y/bin/cuda-uninstaller