Centos8 安装NVIDIA显卡驱动

<1>kernel-devel

yum install kernel-devel

<2>elfutils-libelf-devel

yum install elfutils-libelf-devel

yum install gcc
yum install gcc-c++
 

sudo yum install epel-release

yum install --enablerepo=epel dkms

下载NVIDIA-Linux-x86_64-418.88.run这个安装包

wget https://cn.download.nvidia.cn/XFree86/Linux-x86_64/418.88/NVIDIA-Linux-x86_64-418.88.run

chmod a+x ./NVIDIA-Linux-x86_64-418.88.run
./NVIDIA-Linux-x86_64-418.88.run --no-opengl-files

reboot now

这里着重提示,NVIDIA-Linux-x86_64-418.88.run,注意后面这几个数字418.88,418应该跟你的内核版本一致.

例如:笔者的内核版本如下:

# yum list | grep kernel
kernel.x86_64                                              4.18.0-80.el8                                           @anaconda
kernel.x86_64                                              4.18.0-147.5.1.el8_1                               @BaseOS   
kernel-core.x86_64                                    4.18.0-80.el8                                            @anaconda
kernel-core.x86_64                                    4.18.0-147.5.1.el8_1                               @BaseOS   
kernel-devel.x86_64                                  4.18.0-147.5.1.el8_1                               @BaseOS   

马上检查一下,看看是不是成功了.

# nvidia-smi
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 418.88       Driver Version: 418.88       CUDA Version: 10.1     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  Quadro P1000        Off  | 00000000:01:00.0  On |                  N/A |
| 34%   50C    P0    N/A /  N/A |    159MiB /  4039MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0      2866      G   /usr/libexec/Xorg                             64MiB |
|    0      2974      G   /usr/bin/gnome-shell                          90MiB |
|    0      4014      G   /usr/lib64/firefox/firefox                     1MiB |
+-----------------------------------------------------------------------------+

三.可能出现的问题及处理:
1.ERROR: You appear to be running an X server;

表示你不能在图形界面下安装驱动,解决办法:修改系统启动模式,不再默认进入图形界面,而是进入字符界面

!!注意!! CentOS 8不再支持修改/etc/inittab来定义启动模式了,请使用以下命令进行操作

systemctl get-default  -->这个命令表示查看当前启动模式,可以忽略

systemctl set-default multi-user.target  -->这个命令表示设置成启动进入字符模式

reboot now

这样重启后就进入字符模式了,完事后可以用以下命令修改启动模式.

systemctl set-default graphical.taget

2.ERROR: The Nouveau kernel driver is currently in use by your system.

表示系统已经安装了Nouveau的显卡驱动,需要禁用或者干掉这个驱动

A.编辑/etc/modprobe.d/blacklist.conf
vi /etc/modprobe.d/blacklist.conf

这个文件可能是全新的,不要管它,直接加入
blacklist nouveau

B.运行命令备份与重建initramfs

mv /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r).img.bak

dracut -v /boot/initramfs-$(uname -r).img $(uname -r)
重启系统

reboot now

你会发现字符都变大了,不过没关系,驱动安装完之后就正常了.

3.ERROR: Installation has failed. Please see the file '/var/log/nvidia-installer.log' for details

这个错误提示让人崩溃,没办法只能查看LOG了,笔者的结果如下:

   In file included from /tmp/selfgz1186/NVIDIA-Linux-x86_64-390.87/kernel/common/inc/nv-linux.h:136,
                    from /tmp/selfgz1186/NVIDIA-Linux-x86_64-390.87/kernel/nvidia/nv-chrdev.c:15:
   /tmp/selfgz1186/NVIDIA-Linux-x86_64-390.87/kernel/common/inc/nv-list-helpers.h:94:19: error: redefinition of ‘list_is_first’
      94 | static inline int list_is_first(const struct list_head *list,
         |                   ^~~~~~~~~~~~~
   In file included from /tmp/selfgz1186/NVIDIA-Linux-x86_64-390.87/kernel/common/inc/nv-linux.h:136,
                    from /tmp/selfgz1186/NVIDIA-Linux-x86_64-390.87/kernel/nvidia/nv-acpi.c:15:
   /tmp/selfgz1186/NVIDIA-Linux-x86_64-390.87/kernel/common/inc/nv-list-helpers.h:94:19: error: redefinition of ‘list_is_first’
      94 | static inline int list_is_first(const struct list_head *list,
         |                   ^~~~~~~~~~~~~
   In file included from /tmp/selfgz1186/NVIDIA-Linux-x86_64-390.87/kernel/common/inc/nv-linux.h:136,
                    from /tmp/selfgz1186/NVIDIA-Linux-x86_64-390.87/kernel/nvidia/nv-frontend.c:13:
   /tmp/selfgz1186/NVIDIA-Linux-x86_64-390.87/kernel/common/inc/nv-list-helpers.h:94:19: error: redefinition of ‘list_is_first’
      94 | static inline int list_is_first(const struct list_head *list,
         |                   ^~~~~~~~~~~~~
   In file included from /tmp/selfgz1186/NVIDIA-Linux-x86_64-390.87/kernel/common/inc/nv-linux.h:136,
                    from /tmp/selfgz1186/NVIDIA-Linux-x86_64-390.87/kernel/nvidia/nv-instance.c:13:
   /tmp/selfgz1186/NVIDIA-Linux-x86_64-390.87/kernel/common/inc/nv-list-helpers.h:94:19: error: redefinition of ‘list_is_first’
      94 | static inline int list_is_first(const struct list_head *list,
         |                   ^~~~~~~~~~~~~
问题在于系统内核与驱动内核存在版本上的差异,需要用相匹配的版本<<注意nvidia提供的驱动包的后面几个数字,它们对应着你的内核的版本>>.
 

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值