> ## Content Index
> Fetch the complete content index at: https://yinguobing.com/blog/llms.txt
> Use this file to discover other available public pages before exploring further.

# 以Runfile的方式在Ubuntu Server 20.04安装NVIDIA驱动
- URL: https://yinguobing.com/blog/install-nvidia-driver-runfile-ubuntu-server-20-04/
- Published: 2022-07-21T02:09:25.000Z
- Updated: 2022-07-21T02:09:25.000Z
- Description: 新手友好，手把手教程
- Author: 尹国冰
- Tags: 新手入门

Ubuntu下的NVIDIA驱动安装大致分为两种方式。一种是通过包管理器安装，需要使用 `apt-get` 或者 `dpkg` 命令；另一种通过 `runfile` 的形式安装。本文记录了后者的具体过程。

### 获取驱动安装文件

NVIDIA驱动的官方下载地址

[Download the latest official NVIDIA driversDownload the latest official NVIDIA drivers![](https://www.nvidia.com/favicon.ico)Subscribe![](https://www.nvidia.com/content/dam/en-zz/Solutions/geforce/drivers/cut-graphics/nvidia-geforce-drivers-meta-image-1200x627.jpg)](https://www.nvidia.com/Download/index.aspx?ref=yinguobing.com)

按照实际安装的硬件型号选择合适的驱动版本。如果你不清楚安装哪一个版本，尽量选日期最新的。

驱动安装文件是一个后缀名为 `.run` 的文件，例如：`NVIDIA-Linux-x86_64-515.57.run`。将其下载到待安装机器上的合适目录下。

### 安装依赖项

使用快捷键 `Ctrl + Alt + T` 开启终端并输入以下命令安装 `gcc` 与 `make` 。

```bash
sudo apt install gcc make
```

### 开始安装

💡

安装驱动需要系统管理员权限。

在终端中执行如下指令开始安装：

```bash
sudo sh NVIDIA-Linux-x86_64-515.57.run
```

安装过程中会有三次需要人工干预的地方。

第一个：X library path 相关警告，回车OK即可。

![](https://yinguobing.com/blog/content/images/2022/07/0-x-lib.png)

第二个：32位兼容库，一般选择No。

![](https://yinguobing.com/blog/content/images/2022/07/2-bit32.png)

第三个：是否需要自动更新 X配置文件，选择No即可。

![](https://yinguobing.com/blog/content/images/2022/07/1-x-driver.png)

经过以上步骤之后，驱动安装完成，显示完成界面。

![](https://yinguobing.com/blog/content/images/2022/07/done.png)

安装成功

### 常见错误

在安装过程中可能遇到以下错误。

错误1： `Unable to find the development tool cc in your path`.

![](https://yinguobing.com/blog/content/images/2022/07/error-gcc.png)

解决方案：安装gcc `sudo apt install gcc`

错误2：`Unable to find the development tool make in your path`.

![](https://yinguobing.com/blog/content/images/2022/07/error-make.png)

解决方案：安装make `sudo apt install make`