How to install the latest Nvidia drivers on Ubuntu 16.04 Xenial Xerus

The following tutorial will guide you through all steps required to install VGA NVIDIA driver on Ubuntu 16.04 Xenial Xerus Linux.

To install Nvidia driver on other Linux distributions, follow our Nvidia Linux Driver guide.

Let’s start by detecting your NVIDIA VGA card model. Open terminal and enter a following linux command:

$  lshw -numeric -C display
or
$ lspci -vnn | grep VGA

The above commands will output your NVIDIA model number. For example:

$ lspci -vnn | grep VGA
01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GK104 [GeForce GTX 680] [10de:1180] (rev a1) (prog-if 00 [VGA controller])

The model used by this system is GeForce GTX 680. In the next step we will use this information to find a correct NVIDIA driver within a Ubuntu’s package repository. However, before that, navigate your browser to NVDIA driver search page and enter your details:

NVIDIA search driver page

After a successful search take a note of the resulting driver version number:

Version: 	361.42
Release Date: 	2016.3.30
Operating System: 	Linux 64-bit
Language: 	English (US)
File Size: 	82.74 MB 


The driver version number is 361.42. Depending on your relevant NVIDIA driver number based on the above search, install the actual NVIDIA driver directly from Ubuntu’s repository using apt-get command:

VERSION: 304
$ sudo apt-get install nvidia-304
VERSION: 340
$ sudo apt-get install nvidia-340
VERSION: 361
$ sudo apt-get install nvidia-361
...
Done.

nvidia_361:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/4.4.0-18-generic/updates/dkms/

nvidia_361_modeset.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/4.4.0-18-generic/updates/dkms/

nvidia_361_uvm.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/4.4.0-18-generic/updates/dkms/

depmod........

DKMS: install completed.
Setting up ocl-icd-libopencl1:amd64 (2.2.8-1) ...
Setting up nvidia-opencl-icd-361 (361.42-0ubuntu1) ...
Setting up bbswitch-dkms (0.8-3ubuntu1) ...
Loading new bbswitch-0.8 DKMS files...
First Installation: checking all kernels...
Building only for 4.4.0-18-generic
Building initial module for 4.4.0-18-generic
Done.

bbswitch:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/4.4.0-18-generic/updates/dkms/

depmod....

DKMS: install completed.
Setting up nvidia-prime (0.8.2) ...
Setting up screen-resolution-extra (0.17.1) ...
Setting up nvidia-settings (361.42-0ubuntu1) ...
Setting up vdpau-driver-all:amd64 (1.1.1-3ubuntu1) ...
Processing triggers for libc-bin (2.23-0ubuntu2) ...
Processing triggers for initramfs-tools (0.122ubuntu6) ...
update-initramfs: Generating /boot/initrd.img-4.4.0-18-generic
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for dbus (1.10.6-1ubuntu3) ...

Now you are ready to reboot your system. After reboot, your can access NVIDIA’s configuration menu using start button and searching for nvidia:

NVIDIA configuration menu