linux 显卡驱动安装和cuda安装

1、安装系统插件

yum -y install gcc kernel-devel kernel-headers

2、禁止开源驱动

vim /usr/lib/modprobe.d/dist-blacklist.conf
添加blacklist nouveau
注释blacklist nvidiafb

3、重新建立文件

rm -rf /boot/initramfs-$(uname -r).img.bak
mv /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r).img.bak
dracut /boot/initramfs-$(uname -r).img $(uname -r)
reboot

4、安装驱动

init 3 #相当于关闭了x windows 这样才能安装驱动
chmod +x NVIDIA-Linux-x86_64-460.73.01.run
./NVIDIA-Linux-x86_64-460.73.01.run
#看需要进行reboot

5、验证安装

nvidia-smi 

6、安装cuda

sudo sh cuda_10.2.89_440.33.01_linux.run

7、编辑配置文件

vim ~/.bash_profile
#添加以下命令
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda-10.2lib64:/usr/local/cuda-10.2/extras/CUPTI/lib64"
export CUDA_HOME=/usr/local/cuda-10.2
vim ~/.bashrc
#添加下面两行代码
export PATH=/usr/local/cuda-10.2/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH

source ~/.bashrc

 8、设置环境变量和动态链接库

vim /etc/profile
export PATH=/usr/local/cuda/bin:$PATH
export  LD_LIBRARY_PATH=/usr/local/cuda-10.2/lib64$LD_LIBRARY_PATH

保存之后,创建链接文件:

vim /etc/ld.so.conf.d/cuda.conf
#添加文件
/usr/local/cuda/lib64
sudo ldconfig

9、验证cuda是否安装成功

cd /usr/local/cuda-10.2/samples/1_Utilities/deviceQuery
sudo make
./deviceQuery

 

你可能感兴趣的:(linux,centos,nvidia)