查看是否能检测到显卡
lspci | grep -i nvidia
禁用nouveau:
sudo vim /etc/modprobe.d/blacklist-nouveau.conf
添加如下内容:
blacklist nouveau
blacklist lbm-nouveau
options nouveau modeset=0
alias nouveau off
alias lbm-nouveau off
备份镜像和重塑镜像:
sudo mv /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r).img.bak
sudo dracut /boot/initramfs-$(uname -r).img $(uname -r)
错误
ERROR: Unable to find the development tool
cc
in your path; please make sure that you have the package 'gcc' installed. If gcc is installed on your system, then please check thatcc
is in your PATH.
sudo yum install gcc-c++
ERROR: Unable to find the development tool
make
in your path; please make sure that you have the package 'make' installed. If make is installed on your system, then please check thatmake
is in your PATH.
sudo yum install make
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.
这个稍微有点麻烦, 确保这些版本都是能对上的..
uname -r
rpm -qa |grep kernel
yum info kernel-devel kernel-headers
sudo yum install -y kernel-devel kernel-headers
检查
nvidia-smi
看到下面内容,安装成功!
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 525.116.04 Driver Version: 525.116.04 CUDA Version: 12.0 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|===============================+======================+======================|
| 0 NVIDIA GeForce ... Off | 00000000:06:00.0 Off | N/A |
| 30% 46C P0 119W / 350W | 0MiB / 24576MiB | 0% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
| 1 NVIDIA GeForce ... Off | 00000000:07:00.0 Off | N/A |
| 30% 46C P0 121W / 350W | 0MiB / 24576MiB | 0% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
| 2 NVIDIA GeForce ... Off | 00000000:0D:00.0 Off | N/A |
| 30% 47C P0 104W / 350W | 0MiB / 24576MiB | 0% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
| 3 NVIDIA GeForce ... Off | 00000000:0E:00.0 Off | N/A |
| 30% 47C P0 115W / 350W | 0MiB / 24576MiB | 2% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+