借鉴博客:地址
一、安装NVIDIA 显卡驱动
1、屏蔽 nouveau 驱动
编写(如果没有会新建),下面两个文件
# vi /etc/modprobe.d/nvidia-installer-disable-nouveau.conf
显卡cuda、# vi /lib/modprobe.d/nvidia-installer-disable-nouveau.conf
在两个文件下写入如下内容
blacklist nouveau
options nouveau modeset=0
2、重做 initramfs 镜像
①给当前镜像做备份
centos查看显卡驱动版本?cp /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r).img.bak
②建立新的镜像
dracut /boot/initramfs-$(uname -r).img $(uname -r)
③重启
reboot
3、预安装组件(联网)
centos7安装nvidia显卡驱动、yum install gcc kernel-devel kernel-headers
4、根据当前系统内核下载 NVIDIA 官方驱动
地址:https://www.nvidia.cn/Download/index.aspx?lang=cn#
5、安装 NVIDIA驱动
执行如下的安装步骤,必需指定 kernel source path,否则会报错;kernel 的版本和系统内核有关,可能会有差别
①定位到驱动下载到的目录
重装显卡驱动后cuda要重装吗?②执行
./NVIDIA-Linux-x86_64-450.66.run --kernel-source-path=/usr/src/kernels/3.10.0-1127.19.1.el7.x86_64 -k $(uname -r)
说明:
NVIDIA-Linux-x86_64-450.66.run是下载的驱动;
3.10.0-1127.19.1.el7.x86_64是通过ll /usr/src/kernels/命令查看的系统内核源码
6、安装解压
如何重装英伟达显卡驱动,Verifying archive integrity... OK
Uncompressing NVIDIA Accelerated Graphics Driver for Linux-x86_64 384.81.......................................
..................................................................
..................................................................
常规选择即可
安装 32 位兼容库 -yes
linux如何安装cuda。PS:大多数默认选择就可以,有一些是与NVIDIA做后期交互的一些选择,也是默认即可
7、验证
执行:
lspci |grep NVIDIA
nvidia-smi
如下效果表示安装成功
centos显卡驱动、二、安装CUDA驱动
1、下载CUDA
地址:https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64&target_distro=CentOS&target_version=7&target_type=rpmnetwork
根据提供地址,下载到本地
2、安装
安装执行:
centos和ubuntu哪个好、./cuda_11.0.3_450.51.06_linux.run
此时可能会出现权限不足的情况,需要进行授权,这里我直接给了最高权限
chmod 777 cuda_11.0.3_450.51.06_linux.run
之后会出现协议,选择接受:
安装:
这里面不需要再装显卡驱动了(这里截图有错)
centos安装nvidia显卡驱动,出现了警告信息,对安装无影响
截图日志:
[root@host83 masr]# sudo sh cuda_11.0.3_450.51.06_linux.run
===========
= Summary =
===========
centos安装cuda、Driver: Not Selected
Toolkit: Installed in /usr/local/cuda-11.0/
Samples: Installed in /root/, but missing recommended libraries
Please make sure that
- PATH includes /usr/local/cuda-11.0/bin
- LD_LIBRARY_PATH includes /usr/local/cuda-11.0/lib64, or, add /usr/local/cuda-11.0/lib64 to /etc/ld.so.conf and run ldconfig as root
cuda和nvidia驱动的关系。To uninstall the CUDA Toolkit, run cuda-uninstaller in /usr/local/cuda-11.0/bin
***WARNING: Incomplete installation! This installation did not install the CUDA Driver. A driver of version at least .00 is required for CUDA 11.0 functionality to work.
To install the driver using this installer, run the following command, replacing with the name of this run file:
sudo .run --silent --driver
Logfile is /var/log/cuda-installer.log
也可以进入日志进行查看(位置如下):
amd显卡没有cuda怎么办、/var/log/cuda-installer.log
3、 配置环境变量
vi /etc/profile
进入文件,添加配置
export PATH=/usr/local/cuda/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
centos7.8安装显卡驱动。使环境变量立即生效
source /etc/profile ;
安装完成!
若有帮助记得点赞哦~
版权声明:本站所有资料均为网友推荐收集整理而来,仅供学习和研究交流使用。
工作时间:8:00-18:00
客服电话
电子邮件
admin@qq.com
扫码二维码
获取最新动态