I am Charmie

メモとログ

NVIDIA driver on Ubuntu 18.04

This post describes how to install an NVIDIA driver on Ubuntu 18.04. The official CUDA toolkit documentation didn't work me. I tried package manager based installation and it worked.

Step 1. Disable the Nouveau drivers
Nvidia driver installation requires the nouveau drivers disable. This is done by the following code.
$ sudo bash -c "blacklist nouveau" > /etc/modprobe.d/blacklist-nouveau.conf
$ sudo bash -c "options nouveau setmode=0" >> /etc/modprobe.d/blacklist-nouveau.conf
$ sudo update-initramfs -u
$ sudo reboot

Step 2. Install the pre-requisites
The following command installs the pre-requisites.
$ sudo apt install build-essential linux-headers-4.18.0-17-generic
The version information is confirmed by the following command.
$ uname -r

Step 3. Install the NVIDIA drivers
The following command installs the NVIDIA drivers.
$ sudo add-apt-repository ppa:graphics-drivers/ppa
$ sudo apt update
$ sudo apt install nvidia-driver-418 nvidia-settings
$ sudo reboot

Step 4. Confirm the installation
We can check the driver version from the following code.
$ nvidia-smi