Skip to content

Latest commit

 

History

History

driver

How to install nvidia driver on Linux system

Source: https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#network-repo-installation-for-ubuntu

&

https://docs.nvidia.com/datacenter/tesla/tesla-installation-notes/index.html

All version: https://www.nvidia.com/Download/Find.aspx

Download: https://www.nvidia.com/Download/index.aspx

Table of contents

Ubuntu 18.04

Method 1 (easiest)

Select available driver from Software & Updates application

Softwares & Updates

Method 2 (using pakage manager)

Step 1: Add nvidia keyring & apt repo

wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-keyring_1.0-1_all.deb
sudo dpkg -i cuda-keyring_1.0-1_all.deb
sudo apt-get update

Step 2: List out all available nvidia drivers

sudo apt update
sudo apt list nvidia-driver-*

Step 3: Choose one of the list of available drivers & install Driver list

sudo apt install nvidia-driver-<version>

Method 3 (manually)

Pre-installation Actions

Step 1: Disable the Nouveau drivers

_ Create a file at /etc/modprobe.d/blacklist-nouveau.conf with the following contents:

blacklist nouveau
options nouveau modeset=0

Quick cmd

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

Step 2: Download & Calculate the MD5 checksum of the downloaded file

md5sum <file>

Step 3: Install kernel headers & necessary packages

sudo apt install linux-headers-$(uname -r) libglvnd-dev pkg-config dkms

Step 4: Uninstall old installation

Depend on the way the previous nvidia driver was installed, unistall it using one of below methods:

_ For installing using pkg manager

sudo apt remove nvidia-driver-<branch>

_ For installing using *.run file

sudo ./<driver_file>.run --uninstall

Installation steps

Step 1: Reboot and login to virtual console (tty) by pressing ctrl + alt + F2/.../F6

Step 2: Go to the directory which contains downloaded drivers & run the *.run file (with options if necessary. Ex: --dkms)

sudo ./<driver_file>.run --dkms

NOTE: See here for list of avalable options

NOTE: For more instruction from nvidia, see here

CentOS 7

Pre-installation Actions

Step 1: Install necessary packages

sudo dnf install -y tar bzip2 make automake gcc gcc-c++ pciutils elfutils-libelf-devel libglvnd-devel iptables firewalld vim bind-utils wget

Step 2: Install kernel headers

sudo yum install kernel-devel-$(uname -r) kernel-headers-$(uname -r)

Step 3: Uninstall old installation

Depend on the way the previous nvidia driver was installed, unistall it using one of below methods:

_ For installing using pkg manager

sudo yum remove nvidia-driver-latest-dkms

_ For installing using *.run file

sudo ./<driver_file>.run --uninstall

Method 1 (using pakage manager)

Step 1: Satisfy the external dependency on EPEL for DKMS

sudo yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

Step 2: Install the CUDA repository public GPG key

distribution=rhel7
ARCH=$( /bin/arch )
sudo yum-config-manager --add-repo http://developer.download.nvidia.com/compute/cuda/repos/$distribution/${ARCH}/cuda-$distribution.repo

Step 3: Update the repository cache and install the driver using the nvidia-driver-latest-dkms meta-package

sudo yum clean expire-cache
sudo yum install -y nvidia-driver-latest-dkms

Method 2 (manually)

Step 1: Download & Calculate the MD5 checksum of the downloaded file

md5sum <driver_file>

Step 2: Disable the Nouveau drivers

_ Create a file at /etc/modprobe.d/blacklist-nouveau.conf with the following contents:

blacklist nouveau
options nouveau modeset=0

_ Regenerate the kernel initramfs:

sudo dracut --force

Step 3: Go to the directory which contains downloaded drivers & run the *.run file (with options if necessary. Ex: --dkms)

sudo ./<driver_file>.run

NOTES

For notebook, to utilize nvidia GPU for all graphic applications, remember to change PRIME profiles to NVIDIA (Performance Mode)

Alternative method is cmd sudo prime-select (nvidia|intel|on-demand|query)