CentOS 7.x 安装 NVIDIA 显卡驱动详细步骤

CentOS 7.x 安装 NVIDIA 显卡驱动详细步骤

LonelyMan 1074 2023-04-13

步骤

  1. NVIDIA官方驱动下载下载显卡所对应的驱动,名称为NVIDIA-Linux-x86_64-xxxxxxxx.run

  2. 安装NVIDIA驱动安装所需依赖

    [root@localhost home]# yum -y install kernel-devel kernel-headers elfutils-libelf-devel zlib-devel gcc make
    
  3. 复制到/home下,执行

    [root@localhost home]# sh NVIDIA-Linux-x86_64-470.182.03.run
    

    若显示如下错误

    ERROR: The Nouveau kernel driver is currently in use by your system.  This driver is incompatible with the NVIDIA driver, and must be disabled before proceeding.  Please consult the NVIDIA driver README and your Linux distribution's documentation for details on how to correctly disable the Nouveau kernel driver.
    

    则需禁用Nouveau 驱动

    Nouveau 是由第三方为 NVIDIA 显卡开发的一个开源 3D 驱动,也没能得到 NVIDIA 的认可与支持。虽然 Nouveau Gallium3D 在游戏速度上还远远无法和 NVIDIA 官方私有驱动相提并论,不过却让 Linux 更容易的应对各种复杂的 NVIDIA 显卡环境,让用户安装完系统即可进入桌面并且有不错的显示效果,所以,很多 Linux 发行版默认集成了 Nouveau 驱动,在遇到 NVIDIA 显卡时默认安装。

    1. 查看显卡硬件是否正确识别
    [root@localhost home]# lspci | grep VGA
    03:00.0 VGA compatible controller: NVIDIA Corporation GK110GL [Quadro K6000] (rev a1)
    
    1. 检查nouveau是否被加载

      [root@localhost home]# lsmod | grep nouveau
      nouveau              1899494  1 
      video                  24538  1 nouveau
      mxm_wmi                13021  1 nouveau
      i2c_algo_bit           13413  1 nouveau
      drm_kms_helper        186531  1 nouveau
      ttm                    96673  1 nouveau
      drm                   456166  4 ttm,drm_kms_helper,nouveau
      wmi                    21636  5 dell_smbios,dell_wmi_descriptor,mxm_wmi,nouveau,intel_wmi_thunderbolt
      
      
    2. 禁用nouveau

      [root@localhost home]# vi /etc/modprobe.d/blacklist-nouveau.conf
      ----------
      #添加以下内容在最后
      blacklist nouveau
      options nouveau modeset=0
      
      [root@localhost home]# dracut --force
      [root@localhost home]# reboot
      
  4. 查看显卡信息

    [root@localhost home]# nvidia-smi
    Thu Apr 13 17:05:13 2023       
    +-----------------------------------------------------------------------------+
    | NVIDIA-SMI 470.182.03   Driver Version: 470.182.03   CUDA Version: 11.4     |
    |-------------------------------+----------------------+----------------------+
    | 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  Quadro K6000        Off  | 00000000:03:00.0 Off |                  Off |
    | 29%   49C    P0    40W / 225W |      0MiB / 12206MiB |      1%      Default |
    |                               |                      |                  N/A |
    +-------------------------------+----------------------+----------------------+
                                                                                   
    +-----------------------------------------------------------------------------+
    | Processes:                                                                  |
    |  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
    |        ID   ID                                                   Usage      |
    |=============================================================================|
    |  No running processes found                                                 |
    +-----------------------------------------------------------------------------+
    
    

参考

在 CentOS/RHEL 上安装 NVIDIA 驱动程序和 Vulkan - 重型。人工智能文档 (heavy.ai)

CentOS 8 : NVIDIA Tools : Server World (server-world.info)

Ubuntu 安装 NVIDIA 显卡驱动详细步骤(ERROR: The Nouveau kernel driver is currently in use by your system)_ubuntu安装nvidia驱动_wohu1104的博客-CSDN博客