How to Install Nvidia Drivers on Fedora

October 7, 2021

Introduction

Keeping your GPU drivers up to date ensures system running smoothly and at peak performance. Since Fedora doesn't come with the proprietary Nvidia drivers already installed, administrators need to install and regularly update them.

In this tutorial, we will show you how to install Nvidia drivers on Fedora manually or using third-party tools.

How to install Nvidia drivers on Fedora

Prerequisites

  • A system running Fedora
  • An account with sudo privileges
  • Access to the terminal window

Install Nvidia Drivers with RPM Fusion

Using RPM Fusion lets you automate most of the installation process for Nvidia drivers.

Step 1: Enable RPM Fusion Repositories

1. Start by updating your Fedora system with:

sudo dnf update

Type Y and press Enter to confirm the update when prompted.

2. Add the RPM Fusion repositories to your Fedora system.

Option 1: Adding RPM Repositories via the Terminal Window

Add the RPM repositories using the following commands in the terminal. For free repositories, use:

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

For non-free repositories, use:

https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm

When prompted, type Y and press Enter to confirm each installation.

Option 2: Adding RPM Repositories via GUI

Visit the RPM Fusion Configuration page and scroll down until you find the link to the free RPM repositories package that matches your version of Fedora. In this example, we are using Fedora 33:

Select the version of RPM repositories that matches your system

Click the link and select the Open option in Firefox. Click OK to confirm.

Open the repository package using Firefox

In Software Center, click the Install button to add the RPM repositories to your system. When prompted, enter the administrator password to proceed with the installation.

Install the repositories using the Software Center

Repeat the process outlined above for non-free RPM repositories.

Step 2: Detect Nvidia Card

Use the lspci command to detect the model of your GPU:

lspci | grep VGA
Detect your GPU model using the lspci command

In this example, we are installing drivers for a GeForce GTX 1060 GPU.

Step 3: Install Nvidia Drivers

1. Depending on your GPU model, use the appropriate command to install corresponding Nvidia drivers. For current GeForce/Quadro/Tesla models, use:

sudo dnf install akmod-nvidia

For legacy drivers for GeForce 400/500 models, use:

sudo dnf install xorg-x11-drv-nvidia-390xx akmod-nvidia-390xx

For legacy drivers for GeForce 8/9/200/300 models, use:

sudo dnf install xorg-x11-drv-nvidia-340xx akmod-nvidia-340xx

When prompted, type Y and press Enter to confirm the installation.

2. Reboot your system for the installation to take effect:

sudo reboot

Manually Install Nvidia Drivers Using the Official Nvidia.com Package

Manually installing Nvidia drivers is a more complex and time-consuming process than using RPM Fusion. However, this method allows for greater customization and more control over which drivers you install.

Note: You have to disable UEFI Secure Boot in your system's BIOS before attempting to install Nvidia drivers manually.

Step 1: Detect Nvidia Card

Using the lspci command, detect your GPU model:

lspci | grep VGA
Use the lspci command to detect your GPU model

Step 2: Download Nvidia Driver

1. Use the Nvidia driver search tool to find the appropriate driver for your GPU model. Select the series, model, and operating system from the drop-down menus. Download Type should be Production Branch as the other option is for testing purposes. Click Search to find the correct driver.

In this example, we are looking for a GeForce GTX 1060 (Series 10) driver for a 64-bit Linux OS:

Nvidia driver search tool

2. Click the Download button to open the download page for the recommended driver.

Click the Download button to open the driver page

Click the Download button on the new page to start downloading.

Click the Download button to start the download

3. To make the installation process more streamlined, move the driver package in the Home directory once the download finishes.

4. Change the permissions to make the driver package executable:

chmod +x [path to driver package]

In this example, we are using:

chmod +x NVIDIA-Linux-x86_64-470.74.run

Step 3: Install Driver Dependencies

1. Update your Fedora system to the latest version with:

sudo dnf update

Press Y, then Enter to confirm the update when prompted.

2. Reboot your system for the update to take effect:

sudo reboot

3. Install the Nvidia driver compilation dependencies with:

sudo dnf install kernel-devel kernel-headers gcc make dkms acpid libglvnd-glx libglvnd-opengl libglvnd-devel pkgconfig

Confirm the installation by typing Y and pressing Enter when prompted.

Step 4: Disable Default Drivers

1. Create and open a new configuration file. In this example, we are using nano:

sudo nano /etc/modprobe.d/blacklist.conf

2. Add the following lines to the file:

blacklist nouveau
options nouveau modeset=0

3. Save the changes and exit nano by pressing Ctrl+X, typing Y, and pressing Enter.

4. Open the Grub loader configuration file:

sudo nano /etc/default/grub

5. Add rd.driver.blacklist=nouveau to the end of the line that starts with GRUB_CMDLINE_LINUX=. For instance:

GRUB_CMDLINE_LINUX="rhgb quiet rd.driver.blacklist=nouveau"
Edit the Grub configuration file

6. Press Crtl+X, then type Y and press Enter to save changes and exit.

7. Update the Grub configuration file:

sudo grub2-mkconfig -o /boot/grub2/grub.cfg
Updating the Grub configuration file

8. Remove the Xorg x11 driver with:

sudo dnf remove xorg-x11-drv-nouveau

Type Y and press Enter to confirm.

9. Rebuild the kernel initramfs using:

sudo dracut --force /boot/initramfs-$(uname -r).img $(uname -r)

Step 5: Reboot to Multi-User Login

With the default GPU drivers disabled, you need to switch to a text-based login to continue the installation.

1. Enable the text-based, multi-user login with:

systemctl set-default multi-user.target

2. Enter your administrator password in the security prompt and press Enter to confirm.

Switching to multi-user log in

3. Reboot your system:

sudo reboot

Step 6: Install Nvidia Drivers

1. Once the system restarts, log in as the administrator.

Using the multi-user login prompt to log in as the administrator

2. Start the installation process by using:

sudo bash [path to the Nvidia installer package]

In our example, this is:

sudo bash NVIDIA-Linux-x86_64-470.74.run

3. When prompted, select Yes to register the kernel module with DKMS:

Registering the kernel module with DKMS

4. Select Yes to install Nvidia's 32-bit compatibility libraries:

Installing Nvidia's 32-bit compatibility libraries

5. Select Yes to allow automatic Xorg backup:

Confirming automatic Xorg backup

6. Once the installation is complete, select OK to proceed.

Step 7: Enable GUI

1. Enable the GUI login to start up the new Nvidia drivers and bring back the option of using a GUI like GNOME:

systemctl set-default graphical.target

2. Reboot your system to finish the installation:

sudo reboot

Conclusion

After following this tutorial, you should have Nvidia GPU drivers installed and ready to use with your Fedora system.

Was this article helpful?
YesNo
Aleksandar Kovačević
With a background in both design and writing, Aleksandar Kovacevic aims to bring a fresh perspective to writing for IT, making complicated concepts easy to understand and approach.
Next you should read
How to Install Nvidia Drivers on Debian
September 30, 2021

Installing the right drivers for your GPU is necessary to keep your system running efficiently. This tutorial shows you how to install Nvidia rivers on Debian 10.
Read more
How to Install Java on Fedora
April 8, 2021

Java is a programming language used to develop a wide variety of applications. It is supported by virtually all operating systems, including Fedora.
Read more
How to Install an RPM File On Linux OS
February 8, 2024

RPM Package Manager (RPM) is a free and open-source package management system. RPM makes software installation and upgrading easier. Find out how To Install An RPM File In Linux (CentOS & Fedora).
Read more
How To Install Flask
August 29, 2024

Before installing Flask, set up a virtual environment first. This article explains how to set up a virtual environment for Python 2 or Python 3 in Windows, MacOS and Linux. Learn how to install Flask...
Read more