oracle 7.4安装nvidia驱动

2019-8-28

参考网页:

如何在k8s集群中安装nvidia、cuda并使用GPU进行训练

https://blog.csdn.net/u013042928/article/details/78751015/

https://www.cnblogs.com/snake553/p/4941163.html

一,初始环境

oracle linux 7.4 带桌面安装   未做任何更新(安装桌面是为了连接wifi)

二,安装

安装驱动
1)、关闭X server
	 #sudo init 3(建议用这个)
 或  #systemctl stop gdm.service
 
2)禁用nouveau(因为它是一般linxu系统自带的显卡驱动,会和nvidia冲突,所以必须要关掉)

    使用su命令切换到root用户下: su root
    #vi /lib/modprobe.d/dist-blacklist.conf
    将nvidiafb注释掉。
    #blacklist nvidiafb
    然后添加以下语句:
    blacklist nouveau
    options nouveau modeset=0
    
3)重建initramfs image步骤
备份 initramfs 文件
# sudo mv /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r).img.bak
重建 initramfs 文件
# sudo dracut -v /boot/initramfs-$(uname -r).img $(uname -r)
4)修改运行级别为文本模式
systemctl set-default multi-user.target
5)关机重启
#reboot
6)查看nouveau是否已经禁用,没有输出就表示禁用了。必须确定
# lsmod | grep nouveau
7)安装nvidia驱动(在驱动的目录下)
#chmod +x NVIDIA-Linux-x86_64-384.98.run
#sh NVIDIA-Linux-x86_64-384.98.run
选择Accept
32bit兼容包选择, 这里要注意选择NO,不然后面就会出错。
X-configurtion的选择页面YES
后面的都选择默认即可
安装完之后输入nvidia-smi,能显示说明安装正确


****注意:
1)需要安装gcc,否则报错缺少cc环境(会下载内核头文件)
     yum  -y install  gcc
     
2)安装报错没有内核代码树,需要下载当前uname  -r  的kernel-devle-$(uname -r)(使用yum 安装kernel-devle会导致内核版本不一致)

报错:
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 system, for exzmple ,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.
 
处理:
http://rpm.pbone.net/index.php3/stat/4/idpl/37924679/dir/scientific_linux_7/com/kernel-devel-3.10.0-693.el7.x86_64.rpm.html     
如  kernel-devel-3.10.0-693.el7.x86_64.rpm
下载安装后存放位置为 /usr/src/kernels/3.10.0-693.el7.x86_64/     驱动安装时程序自动获取路径

3)首要确认nouveau没有被内核加载,注意操作步骤
原文地址:https://www.cnblogs.com/g2thend/p/11515587.html