How To Install NVIDIA Graphics Drivers In Linux- Ubuntu/Debian/Fedora

Install Nvidia Graphics Driver In Linux

This tutorial is subjected to those who have Linux installed on their desktop and want to install Nvidia graphics driver. Although, most of the newly released Linux distributions come with pre-installed Nvidia drivers, usually in form of Nouveau open-source graphics driver that supports Nvidia graphics cards. Means, if you install a Linux platform, you may require no additional drivers for your graphics card.

But, in case if you are a game lover and want to use as possible from your Nvidia graphics card, then you might need to install official Nvidia drivers for Linux. As already mentioned, most of the Linux platfroms offer proprietary driver package as a part of its standard repository, it’s much easier to install drivers on your desktop.

Alternatively, the users can also seek to download and install latest Nvidia Linux drivers from its official website as well. However, this require users to follow up some hands on measures.

Important Note:

It’s suggested to remain with pre-installed Nvidia drivers for Linux that usually come with Nouveau driver open-soruce package unless you really need it, because installing the driver from third party source may lead to system issues.

How to install Nvidia graphics driver in Linux?

In order to install Nvidia graphics driver in Linux, you first need to do a number of tasks in prior, that includes:

  • Checking current VGA driver
  • Checking Nvidia Linux driver version
  • Checking current model of Nvidia VGA card
  • Install NVIDIA Graphics Drivers In Linux

So, let’s discuss every of these tasks in easy steps here.

Checking Nvidia VGA model

In order to check Nvidia VGA model in your system, run the following command in the terminal:

lspci -vnn | grep VGA

Checking installed VGA card model and driver

lspci -k | grep -EA3 'VGA|3D|Display'

Checking current Nvidia driver version

Since you are going to install the latest Nvidia graphics driver in Linux, you must know the currently installed version on your machine. To do so, run the command below:

nvidia-settings –version

Install Nvidia graphics driver for your machine

Once you are ready with all details derived in the commands above, you can proceed to install Nvidia graphics driver in Linux. We are going to discuss Nvidia Linux driver installation for Ubuntu, Debian, and Fedora Here

For Ubuntu:

At first, navigate to Nvidia official website and download the latest driver package for your Nvidia graphics card depending upon your hardware details. Alternatively, you can also download the driver directly through Nvidia Linux Driver list here.

Once done, you might have a file like one shown below:

ls
NVIDIA-Linux-x86_64-460.67.run

In order to install the file, it’s necessary to compile then install Nvidia driver with the command below:

sudo apt install build-essential libglvnd-dev pkg-config

After this, you need to disable/blacklist Nouveau Nvidia driver on Ubuntu. You should run the following commands:

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"

In order to confirm your action, you need to confirm the content of newly created modeprobe file name blacklist-nvidia-nouveau.conf:

cat /etc/modprobe.d/blacklist-nvidia-nouveau.conf
blacklist nouveau
options nouveau modeset=0

Once done, reboot your desktop to take the changes in effect. After the system reboots, you need to stop the current display server. Just run the command below:

sudo telinit 3

After you run this command, you will require to hit CTRL+ALT+F1 key combination and login your system again with user credentials to start a new TTY1 session. Now, you can start the installation of Nvidia driver by running the following command:

sudo bash NVIDIA-Linux-x86_64-460.67.run
OR
sudo bash NVIDIA-Linux-x86_64-*.run

Executing the command will run a wizard, follow on screen instructions to complete the installation setup. You should now reboot the system once again with:

sudo reboot

After the system boots again, you should be able to initiate Nvidia X Server Settings app from Ubuntu Activities menu. You have successfully installed Nvidia graphics driver in Ubuntu.

For Debian:

In order to install Nvidia graphics driver in Debian by using official Nvidia package, refer to guidelines here mentioned.

At first, open /etc/apt/sources.list as an administrative user, and add the non-free and contrib repository there. Take look below for an instance:

Previous value:
deb http://ftp.au.debian.org/debian/ buster main

Modified value:
deb-src http://ftp.au.debian.org/debian/ buster main non-free contrib

Done? Update the repository index file by running the command below:

apt update

Now, install nvidia-detect utility with the command:

apt -y install nvidia-detect

Run the nvidia-detect on your machine to detect Nvidia card model and suggested driver. You just need to run the following command:

nvidia-detect

In the output, you will be shown with a recommended Nvidia Driver number. Just search the same driver source package over official Nvidia website, and download it on your machine. The saved file might be under your home directory. You can view the downloaded file by running:

ls NVIDIA-Linux-x86_64-390.116.run

Next is to install the Nvidia driver compilation prerequisites:

apt -y install linux-headers-$(uname -r) build-essential

Now, you would need to disable the default Nouveau driver by running:

echo blacklist nouveau > /etc/modprobe.d/blacklist-nvidia-nouveau.conf

Once disabled, you should Reboot the multi-user run level, and it would disable the GUI after the reboot. You can do this by running commands below:

systemctl set-default multi-user.target
systemctl reboot

Here, you can login to your machine via terminal or TTY, and install the Nvidia driver by executing below command:

bash NVIDIA-Linux-x86_64-390.116.run
Important Note:

The installation command may vary depending upon downloaded Nvidia driver version, so don’t forget to cross check the version number that fits your requirements.

While the installation process is on, you will be asked a few questions. And the questions along with the suggested answer to choose is here mentioned.

Q1: The CC version check failed:

The kernel was built with gcc version 8.2.0 (Debian 8.2.0-14), but the current compiler version is cc (Debian 8.3.0-2) 8.3.0.

This may lead to subtle problems; if you are not certain whether the mismatched compiler will be compatible with your kernel, you may wish to abort installation, set the CC environment variable to the name of the compiler used to compile your kernel, and restart installation.
Ans: Ignore CC version check

Q2: Install NVIDIA's 32-bit compatibility libraries?
Ans: Yes

Q3: An incomplete installation of libglvnd was found. Do you want to install a full copy of libglvnd? This will overwrite any existing libglvnd libraries.
Ans: Install and overwrite existing filesort installation.

Q4: Would you like to run the nvidia-xconfig utility to automatically update your X configuration file so that the NVIDIA X driver will be used when you restart X? Any pre-existing X configuration file will be backed up.
Ans: Yes

All done, now you need to enable the system to boot into GUI once again:

systemctl set-default graphical.target

and finally, just reboot your Debian desktop once again with new Nvidia drivers. Do it through command line by running:

systemctl reboot

For Fedora:

Fedora users can easily install any driver on their desktop using RPM fusion, however if it fails to install the latest Nvidia driver, you can attempt to install Nvidia graphics driver in Linux manually. Here are the instructions to follow:

At first, identify yout Nvidia graphics card model by executing the command below:

lspci -vnn | grep VGA

Based on your graphics card model, you can search and download the latest driver package from Nvidia Official site. Alternatively, if you know what driver package is required for your graphics card, you can download it directly from Nvidia Linux driver list here.

Nvidia Linux Drivers
Search & Download Nvidia Latest Drivers For Linux
Important Note:

Production Branch (LLB): Production Branch drivers provide ISV certification and optimal stability and performance for Unix customers. This driver is most commonly deployed at enterprises, providing support for the sustained bug fix and security updates commonly required.

New Feature Branch (SLB): New Feature Branch drivers provide early adopters and bleeding edge developers access to the latest driver features before they are integrated into the Production Branches

Once your download is ready, you might be able to see the file saved on your desktop. Here’s an instance to list the downloaded file:

ls NVIDIA-Linux-x86_64-*
NVIDIA-Linux-x86_64-430.50.run

Now, it’s required to install prerequisites to compile the Nvidia driver with command here:

sudo dnf groupinstall "Development Tools"
sudo dnf install libglvnd-devel

Now, you should disable the pre-installed Nouveau default driver by altering GRUB boot menu:

sudo grub2-editenv - set "$(sudo grub2-editenv - list | grep kernelopts) nouveau.modeset=0"

Next is to reboot your Fedora desktop by running reboot command:

sudo reboot

In order to install the latest Nvidia driver, the Xorg server must be stopped, so you can switch to other mode by running:

sudo systemctl isolate multi-user.target

Now, you can install the Nvidia driver using terminal (TTY) session, just run the command below (Do make sure to type correct driver version details you have downloaded. Here’s given one is just an instance):

sudo bash NVIDIA-Linux-x86_64-*

The installation begins and you may be asked to answer, installation of Nvidia’s 32-bit compatibility libraries and automatic update of your X configuration file. Just answer it Yes. Once done, reboot your machine once again:

sudo reboot

Once the installation is done, you can reboot and login to Fedora and run nvidia-settings to configure the graphics card settings further.

Note: Since the Xorg server is disabled, you are expected to see a black screen with error logs. To troubleshoot this error, you should restart the systemd-logind service with the command below:

sudo systemctl restart systemd-logind

Conclusion:

We hope, this article might helped you to install Nvidia graphics card driver in Linux platforms easily. If you find any problem, you can share it with us through comment section below. You can also suggest an edit to this tutorial by clicking Suggest Us.