NVIDIA has started to release Linux drivers a lot more often than it used to, and the Ubuntu repositories are not keeping up with all the official releases. Not even the third-party repositories are getting the drivers in the same day. We will show you a very simple way of installing the NVIDIA driver right after you've downloaded it.
Most Ubuntu users install the NVIDIA drivers from the official repositories, but those might be a little too old, if you are a gamer, for example. This is a common occurrence for the Ubuntu repositories, but other distributions, with very few exceptions (Arch Linux for one), have the same problem.
This is where the third-party repositories come into play. Those are a solution, if you are willing to wait. There have been cases where it also took the maintainer of a PPA quite some time to upload the latest version of the NVIDIA driver.
The manual installation of the NVIDIA driver for Linux has two advantages. For one, you don't need an active Internet connection to do it. Secondly, you can do it right after the official release and you don't have to wait for the repositories to get it.
We'll use the latest NVIDIA Linux 334.21 driver as an example, but this method can be used with any new version. You will just have to rename the files accordingly. Let’s assume that you have already downloaded the files.
You will have to do this outside the X session you are currently using. To exit, just press CTRL + ALT + F1. It will open a full screen virtual terminal. Enter your username and password (you will need to be root in order to make these changes).
The NVIDIA files are provided in a .run format. This is not a very common binary file, but it can be easily executed from command line. The trick is that you need to stop the display manager (LightDM), otherwise the NVIDIA Linux installer won't run. Enter the following commands:
sudo service lightdm stop
sudo chmod a+x NVIDIA-Linux-x86_64-334.21.run
After the installation finishes you still need to reboot the system. You can do that from the same terminal, and you don't have to return to the session you were running (unless you were doing something that needs saving).
To return, enter the following command, followed by the CTRL + ALT + F7 combination:
sudo service lightdm start
If you want to just reboot, enter this:
The procedure is quite simple and, once you get the hang of it, you will never depend on the official repositories again.