1. Overview
For Linux users, utilizing the immense graphical powers of an NVIDIA graphics card or GPU (Graphics Processing Unit) is a true advantage. From seamless gameplay to accelerated video editing and scientific computing, the GPU makes a system capable of much more. To unlock its full potential, having the latest NVIDIA drivers on the system is crucial.
These drivers act as a bridge between the operating system (OS) and the GPU, ensuring optimal performance, stability, and compatibility with cutting-edge features. While most Linux distributions offer NVIDIA drivers through their package repositories, these may not always be the absolute latest versions.
In this tutorial, we’ll dive into the process of installing the latest NVIDIA drivers from the .run file on Linux. This approach provides access to the most recent drivers, potentially containing bug fixes, performance enhancements, and support for the newest games and software.
Notably, we’ll perform this operation on Ubuntu. However, the same process can apply to other distributions as well.
2. Remove Pre-Installed NVIDIA Drivers
To begin with, we ensure that there are no previously installed NVIDIA drivers on the system. This enables us to perform a smooth installation of the latest ones.
Let’s use the apt purge command to remove any existing NVIDIA packages (or drivers) along with their configuration files:
$ sudo apt purge nvidia*
Then, we also run the apt autoremove command to remove any unused dependencies associated with the drivers:
$ sudo apt autoremove
Now that all the NVIDIA drivers are completely removed from the system, let’s move on to install the new ones.
3. Downloading the NVIDIA .run File
The next thing to do is to download the latest .run file that contains all the newest NVIDIA drivers for the current system.
So, let’s go to the official Download Drivers page and download the latest .run file from there.
Alternatively, we can use the wget command to download it from the command line:
$ wget https://download.nvidia.com/XFree86/Linux-x86_64/550.100/NVIDIA-Linux-x86_64-550.100.run
After downloading, let’s navigate to the directory where the .run file is downloaded, i.e., /usr/nvidia in this case:
$ cd /usr/nvidia
At this point, we should have a file named similar to NVIDIA-Linux-x86_64-550.100.run, possibly with a newer version. However, we don’t execute it right away as there are some steps that need to be done before that.
4. Installing Required Dependencies
Before installing the driver package, we install the dependencies that are required for NVIDIA drivers to work properly:
$ sudo apt install build-essential gcc-multilib dkms
However, in the case of Fedora, the required dependencies are epel-release, dkms, and libstdc++.i686:
$ sudo yum install epel-release dkms libstdc++.i686
On CentOS, we install dkms and libstdc++.i686:
$ sudo dnf install dkms libstdc++.i686
Let’s proceed with some more pre-installation steps.
5. Blacklist the Nouveau Driver
The Nouveau driver, included by default in the Linux kernel, operates as a software driver for NVIDIA GPUs. However, if this driver is active, its kernel module is ineligible for unloading, which in turn stops the NVIDIA kernel module from getting loaded. Hence, we may need to blacklist the Nouveau driver to make it inactive.
To do this, let’s navigate to the */*etc/modprobe.d directory, create a file named blacklist-nouveau.conf, and add a couple of lines to it:
$ cd /etc/modprobe.d
$ sudo touch blacklist-nouveau.conf
$ sudo nano blacklist-nouveau.conf
blacklist nouveau
options nouveau modeset=0
After editing, let’s save and close the file. Then, we reboot the system to apply the changes.
6. Stop the Display Manager
A display manager carries out the role of managing the GUI (Graphical User Interface) of an operating system. Every distribution comes with a default display manager.
When installing video card drivers, it’s best to stop the default display manager on the system before executing the .run file to ensure a seamless installation process.
The default display manager on Ubuntu is lightdm (Lightweight Display Manager). Let’s stop it using the systemctl command:
$ sudo systemctl stop lightdm
On Fedora, it’s gdm (GNOME Display Manager):
$ sudo systemctl stop gdm
In the case of CentOS, we have to stop kdm (KDE Display Manager):
$ sudo systemctl stop kdm
Upon completion, let’s go to the final step.
7. Installing the NVIDIA Drivers
Now, we can execute the .run file to install the latest NVIDIA drivers on the system.
To that end, we make the file executable:
$ chmod +x NVIDIA-Linux-x86_64-550.100.run
Finally, let’s install the drivers by executing the .run file:
$ sh NVIDIA-Linux-x86_64-550.100.run
After we hit Return, the installer launches in a new window and starts the installation process. During the process, we have to answer a couple of prompts to reach each following step.
Firstly, the installer asks if we want to register the kernel module sources with DKMS (Dynamic Kernel Module Support). DKMS is a framework that helps in building and installing external Linux kernel modules.
Since doing so enables DKMS to automatically build a new module in case we install a different kernel later, we hit Return to give the permission:
Would you like to register the kernel module sources with DKMS?
Then, a prompt asks whether we want to install NVIDIA’s 32-bit compatibility libraries. Here, let’s again hit Return to proceed:
Install NVIDIA's 32-bit compatibility libraries?
Once we give the above permissions, the installer performs the installation of the newest NVIDIA drivers on the machine.
8. Conclusion
In this article, we explored the step-by-step process of using the *.*run file to install the latest NVIDIA drivers on a Linux system.
By following the outlined steps, we can ensure that the NVIDIA GPU hardware is operating at peak performance and is ready to tackle any graphical challenge that comes its way.