Installing NVIDIA Drivers All Major Linux Distributions

Intro

NVIDA supports Linux with its proprietary drivers nearly as well as it does Windows. That said, it’s no secret that NVIDIA has long been the go-to choice for gaming on Linux. Unfortunately, even though the drivers support Linux well, installing them can become more complicated when dealing with different distributions. In many cases, the process is very simple but not well documented. In others, it’s a bit tougher, but there is no reason that you can’t get the latest NVIDIA drivers for your graphics card working on most major distributions.

Ubuntu

Due to its extreme popularity, Ubuntu tends to be a target for support from third party developers and hardware manufacturers. NVIDIA is no exception, and have even worked with Valve to ensure that their drivers work well with Ubuntu. Oddly, the latest driver releases are rarely available through Ubuntu’s official repositories. However, the Ubuntu “Graphics Drivers” team maintains a PPA full of the latest releases, packaged and ready for installation.

So, the first step to installing the NVIDIA drivers is to enable the PPA and update Apt to recognize it.

$ sudo add-apt-repository ppa:graphics-drivers/ppa
$ sudo apt-get update

To install the drivers and some useful extras, run the commands below.

$ sudo apt-get install nvidia-370 nvidia-settings libvdpau
$ sudo nvidia-xconfig

The version number will change, so make sure to look up the right version before installing them. After the install is done, restart the computer, and enjoy your new drivers.

Debian

Installing the drivers on Debian is different depending on the version of Debian being used. It will also be different depending on how fast the package maintainers are moving at that point in time. Debian has an odd track record of falling behind on packaging graphics drivers. Thankfully, as of late, they’ve been much better, and the latest drivers are available, even if they are from the “experimental” repository.

Jessie

Jessie does not have up-to-date drivers. It just doesn’t and never will. However, you can use Apt-pinning to pull updated packages from either Sid or Experimental depending on whether Sid is all the way up-to-date or if you want Beta packages.

Apt-pinning is the process of using the /etc/apt/preferences file to prioritize packages from different repositories. The goal here is to prioritize the NVIDIA packages from the more up-to-date repositories while preserving the rest of the stable release.

The first step is to add either Sid or Experimental to the /etc/apt/sources.list file to enable them on the system. Also, make sure to add non-free, since the drivers are closed source.

deb http://ftp.us.debian.org/debian sid main contrib non-free
#### OR ####
deb http://ftp.us.debian.org/debian experimental main contrib non-free

Then, take a look at /etc/apt/preferences. Chances are, it’s not there, so go ahead and create it. The file has very simple syntax, with each entry consisting of only three parts; the package, the release, and the priority. The package specifies which package the entry applies to. An asterisk designates the entire release. The pin refers to which branch of Debian is being referred to. The priority allows you to set which versions of packages should be pulled first. The higher number in the priority, the higher priority Apt will place on the package. The example below can be used to pull the NVIDIA packages from Sid, but everything else from Jessie. If you want to use Experimental instead of Sid, just write that in its place.

Package: *
Pin: release a=stable
Priority: 1000

Package: *
Pin: release a=unstable
Priority: 1

Package: nvidia-driver
Pin: release a=unstable
Priority: 1001

Package: nvidia-settings
Pin: release a=unstable
Priority: 1001

Now, you can update Apt and install, specifying the unstable repository.

# apt-get -t unstable install nvidia-driver nvidia-settings

Depending, you may need to pin a few more packages in the preferences file, but otherwise, it will install the up-to-date packages from Sid. Use the configuration utility to generate the Xorg file, and restart.

# nvidia-xconfig

After the reboot, the new drivers will be up and running.

Sid

Sid has a much better chance of having the updated packages than Jessie. To install them, first enable non-free packages in /etc/apt/sources.list and update Apt.

deb http://ftp.us.debian.org/debian sid main contrib non-free
###################################
# apt-get update

Then, install the NVIDIA driver and the settings utility through Apt. After the install, generate the Xorg configuration, and restart.

# apt-get install nvidia-driver nvidia-settings
# nvidia-xconfig

If you want to install the latest Beta drivers, they may be available in Experimental, but not Sid. If that is the case, follow the instructions under the Jessie section to enable Experimental and install the packages through Apt-pinning.

Fedora

The Fedora Project doesn’t package any non-free software, but the RPMFusion repository picks up where they left off. RPMFusion is usually good about keeping NVIDIA packages up-to-date. You only need to add the repository to be able to install the latest drivers.

$ su -c 'dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm'

The above command will download and install both the free and non-free RPMFusion repositories.

To install the packages and configure Xorg, type the following.

# dnf install xorg-x11-drv-nvidia akmod-nvidia "kernel-devel-uname-r == $(uname-r)" xorg-x11-drv-nvidia
# dnf -y update
# nvidia-xconfig

You can probably get away with being lazy and just using $ dnf install akmod-nvidia, but the above code ensures that all of the required packages are pulled and up to date. Following the install, update, and enjoy your new drivers.

Arch Linux

Like with most things, Arch makes installing the latest NVIDIA drivers super easy. Make sure that Multilib is enabled on your system, then run the commands below.

# pacman -Syu
# pacman -S nvidia lib32-nvidia-libgl
# nvidia-xconfig

When it’s done, restart, and enjoy your drivers.

Gentoo

Gentoo’s almost as easy as Arch. First, enable the testing release of the nvidia driver in /etc/portage/package.accept_keywords.

x11-drivers/nvidia-drivers ~amd64

Also, add the driver selection to /etc/make.conf.

VIDEO_CARDS="nvidia"

Then, emerge the drivers, generate the Xorg configuration, and switch the OpenGL interface.

# emerge --ask xorg-drivers
# nvidia-xconfig
# eselect opengl set nvidia

Afterward, just restart, and everything will be good to go.

Closing

Installing the latest NVIDIA drivers on Linux doesn’t have to be difficult. By utilizing the latest drivers for you NVIDIA hardware, you can get a top-notch video experience on Linux.



Comments and Discussions
Linux Forum