检查 kernels 版本是否匹配
报错信息: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 systems,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.
先进入相应目录查看是否有相应内核:
cd /usr/src/kernels/&& ls -al
如果为空表示没有,需要自己下载:
不要直接 yum install kernel-devel
因为这样下载下来的内核版本不一定匹配,所以实际的下载命令应该为:
yum install -y kernel-devel-$(uname -r) kernel-headers-$(uname -r)
之后会跳出
End User License Agreement
-------C
NVIDIA Software License Agreement and CUDA Supplement toSoftware License Agreement .
Preface
------
The Software License Agreement in Chapter 1 and the Supplementin Chapter 2 contain license terms and conditions that governthe use of NVIDIA software. By accepting this agreement, youagree to comply with all the terms and conditions applicableto the product(s) included herein.
NVIDIA Driver
Do you accept the above EULA?(accept/decline/quit):
accept
输入accept
CUDA Installer
-[X] Driver
[X]450.51.06+[X] CUDA Toolkit 11.0[X] CUDA Samples 11.0[X] CUDA Demo Suite 11.0[X] CUDA Documentation 11.0
Options
Install
如果输入nvidia-smi有输出表格结果就将Driver取消勾选,如果没有就直接选择install