2020-09-29

环境

  • 操作系统:Ubuntu 18.04LTS
  • 显卡:NVIDIA Geforce RTX 2060 SUPER

安装方式说明

网上有许多种安装方式,但是本人经验,推荐使用run文件手动安装。具体步骤如下:

手动下载驱动

首先在NVIDIA官网上下载对应的驱动

点击search后,下载对应的版本即可。

卸载旧驱动

无论之前是否安装过NVIDIA驱动,都推荐执行这一步骤:

$ sudo apt-get remove --purge nvidia*
# 若安装失败也是这样卸载以及
$ sudo chmod a+x NVIDIA-Linux-x86_64-440.44.run
# 给予可执行权限
$ sudo NVIDIA-Linux-x86_64-440.44.run --uninstall #确保卸载干净。

禁用nouveau驱动

Nouveau是由第三方为NVIDIA显卡开发的一个开源3D驱动,为了让用户安装完系统即可进入桌面,因此很多Linux发行版默认集成了Nouveau驱动。但是Nouveau驱动会影响安装NVIDIA官方驱动,因此在安装前要先禁用Nouveau驱动。

sudo gedit /etc/modprobe.d/blacklist.conf

在文本最后添加

blacklist nouveau

完成后,重启机器。

开始安装

进入存放run文件的目录,执行以下命令:

$ sudo sh NVIDIA-Linux-x86_64-440.44.run -no-x-check -no-nouveau-check -no-opengl-files

本来安装 Nvidia驱动需要关闭 nouveau 驱动和图形界面,加上后面的参数后就不需要那么繁琐,最后一个opengl的参数十分关键,不加上去有可能安装过后重启时会出现循环登录。
安装中可能会出现以下问题:

1. There appears to already be a driver installed on your system (version:      
  390.42).  As part of installing this driver (version: 390.42), the existing  
  driver will be uninstalled.  Are you sure you want to continue?

                 Continue installation      Abort installation 

(选择 Coninue,如果是重装的话)
2. The distribution-provided pre-install script failed!  Are you sure you want
  to continue?                                                                 
       
                 Continue installation      Abort installation       
(选择 Cotinue)
3. Would you like to register the kernel module sources with DKMS? This will    
  allow DKMS to automatically build a new module, if you install a different   
  kernel later.

                          Yes                       No  
(这里选 No)
4. Install NVIDIA's 32-bit compatibility libraries?
                                                                               
                          Yes                       No  
(这里选 No)
5. Installation of the kernel module for the NVIDIA Accelerated Graphics Driver
  for Linux-x86_64 (version 390.42) is now complete.                           
                                                                       
                                       OK

如果能出现第五条,那恭喜,您已成功安装NVIDIA驱动。重启后执行:

$ nvidia-smi

可以看到类似如下的内容:

Wed Sep 11 13:58:25 2019       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 435.21       Driver Version: 435.21       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  GeForce 940MX       Off  | 00000000:03:00.0 Off |                  N/A |
| N/A   39C    P0    N/A /  N/A |    602MiB /  2004MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0      2169      G   /usr/lib/xorg/Xorg                           249MiB |
|    0      2303      G   /usr/bin/gnome-shell                         109MiB |
|    0      2889      G   ...uest-channel-token=14726807182689878412   186MiB |
|    0      3458      G   ...-token=3D67814D6F5E1D850334BE0B40D7F34F     5MiB |
|    0      3821      G   .../下载/pycharm-2019.1.1/jre64/bin/java     2MiB |
|    0      6205      G   ...uest-channel-token=11960780542914565189    44MiB |
+-----------------------------------------------------------------------------+
©️2020 CSDN 皮肤主题: Age of Ai 设计师:meimeiellie 返回首页