---
# System prepended metadata

title: NVIDIA Driver Install
tags: [NV-Driver]

---

# NVIDIA Driver Install
###### tags: `NV-Driver`

0. 安裝```dkms```
    ```bash
    sudo apt install -y dkms
    ```
2. Disable 開源驅動(nouveau)
    ```bash
    # Create a file at /usr/lib/modprobe.d/blacklist-nouveau.conf with the following contents:
    sudo bash -c "echo blacklist nouveau > /etc/modprobe.d/blacklist-nvidia-nouveau.conf"
    sudo bash -c "echo options nouveau modeset=0 >> /etc/modprobe.d/blacklist-nvidia-nouveau.conf"
    # Regenerate the kernel initramfs:
    sudo update-initramfs -u
    ```
    然後請重新開機。
2. 進入終端機模式(關閉```lightdm```)
    ```bash
    # Supposing you have `lightdm` as the desktop manager
    sudo systemctl stop lightdm
    
    # if you don't have lightdm, simply execute:
    # sudo init 3
    ```
3. 下載 & 安裝driver
    ```bash
    # Download the NV driver
    runfile="NVIDIA-Linux-x86_64-430.50.run"
    runfile_url="http://us.download.nvidia.com/XFree86/Linux-x86_64/430.50/${runfile_name}"
    wget -O $runfile $runfile_url
    
    # Install the NV driver
    sudo bash $runfile -a --silent --no-opengl-files --dkms
    ```
4. 打開```lightdm```，恢復桌面模式
    ```bash
    sudo systemctl start lightdm
    ```
5. 於終端機輸入```nvidia-smi```, 看是否有正常顯示GPU的資訊，例如:
    ```
    chweng@DYSK:~$ nvidia-smi
    Wed Feb 20 17:21:57 2019       
    +-----------------------------------------------------------------------------+
    | NVIDIA-SMI 430.50       Driver Version: 430.50       CUDA Version: 10.0     |
    |-------------------------------+----------------------+----------------------+
    | 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 RTX 208...  Off  | 00000000:03:00.0  On |                  N/A |
    | 27%   30C    P8    18W / 250W |     50MiB / 10986MiB |      0%      Default |
    +-------------------------------+----------------------+----------------------+
    |   1  GeForce RTX 208...  Off  | 00000000:07:00.0 Off |                  N/A |
    | 27%   27C    P8    20W / 250W |      0MiB / 10989MiB |      0%      Default |
    +-------------------------------+----------------------+----------------------+

    +-----------------------------------------------------------------------------+
    | Processes:                                                       GPU Memory |
    |  GPU       PID   Type   Process name                             Usage      |
    |=============================================================================|
    |    0      1778      G   /usr/lib/xorg/Xorg                            49MiB |
    +-----------------------------------------------------------------------------+
    ```