How to Install NVIDIA Drivers on Fedora 40 or 39

Upgrading your Fedora Linux with NVIDIA drivers can be a game-changer for your system’s performance and overall user experience. The transition from default or generic drivers to NVIDIA’s proprietary drivers means unlocking new levels of graphics performance, enjoying enhanced stability, and gaining access to the latest features and technologies tailored to your NVIDIA graphics card.

Key Advantages of NVIDIA Drivers on Fedora Linux:

  • Tailored Performance: Explicitly designed for NVIDIA GPUs, ensuring you get the best out of your system for any graphics-intensive task.
  • Cutting-Edge Features: For a superior experience, access the latest gaming and multimedia technologies, including ray tracing and DLSS.
  • Stability and Compatibility: Direct support from NVIDIA guarantees a smooth operation with the latest GPU models, minimizing compatibility issues.
  • Consistent Updates: Regular driver updates from NVIDIA improve performance, add new features, and fix bugs, keeping your system on the cutting edge.

Using various methods, let’s explore the practical steps for installing NVIDIA drivers on Fedora. For most users, using the NVIDIA RPM is ideal. If this is not supported yet, you will need to manually install the drivers, which is covered in the last method.

Remove Previous NVIDIA Installations from Fedora

If you’ve previously installed NVIDIA drivers on your Fedora system and are considering a different installation method outlined in this guide, proceed with caution. Combining multiple NVIDIA repositories can lead to driver conflicts. It’s advisable to revert to the default drivers before initiating a new NVIDIA driver installation.

Note: You can skip this section if you haven’t installed any NVIDIA drivers yet.

Method 1: DNF Method Removal of NVIDIA Drivers

To remove traces of previous NVIDIA installations, run the following command:

sudo dnf remove nvidia* --allowerasing

Remember to delete the repository files, depending on the method you used to install them. For .runfile installations, this is not required.

Method 2: Removing Runfile NVIDIA Driver Installations

If you opted for the “.run” file method to install NVIDIA drivers (a less recommended method due to superior alternatives like the NVIDIA CUDA repository), you’ll need a distinct removal process.

To uninstall the runfile type of installation, execute:

sudo /usr/bin/nvidia-uninstall

Method 3: Removing NVIDIA CUDA Toolkit Runfile Installations

In instances where the CUDA toolkit was installed using the runfile approach, it’s essential to remove it. Execute the command below:

sudo /usr/local/cuda-X.Y/bin/cuda-uninstall

Select Installation Method of NVIDIA Drivers for Fedora

Method 1: Install NVIDIA Drivers via NVIDIA Cuda RPM on Fedora

Before installing, ensure your system is updated to prevent potential conflicts between graphic card drivers and kernels. To update your Fedora system, use the following command:

sudo dnf upgrade --refresh

Select the appropriate one corresponding to your Fedora version to integrate the CUDA repository into your Fedora system.

Import Nvidia CUDA Repository for Fedora 39:

sudo dnf config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/fedora39/x86_64/cuda-fedora39.repo

Import Nvidia CUDA Repository for Fedora 38:

Note: Nvidia did not make 38 branch drivers. If you are still on Fedora 38, I strongly urge you to upgrade to Fedora 39 and utilize the RPM repo above; if not, use the manual method below.

Proceed to install the necessary dependencies for NVIDIA Drivers:

sudo dnf install kernel-headers kernel-devel tar bzip2 make automake gcc gcc-c++ pciutils elfutils-libelf-devel libglvnd-opengl libglvnd-glx libglvnd-devel acpid pkgconfig dkms

To view the NVIDIA RPM modules, execute:

sudo dnf module list nvidia-driver
sudo dnf module install nvidia-driver:latest-dkms

To install the latest NVIDIA drivers using the DKMS method, execute:

For those interested, the latest NVIDIA open-source branch is available for installation, which can be installed with the following command:

sudo dnf module install nvidia-driver:open-dkms

Opting for a branch with the “-dkms” suffix is advisable to circumvent potential challenges during system upgrades. Moreover, many users have reverted to the proprietary NVIDIA drivers due to reported issues with the NVIDIA open-source drivers on Fedora and Ubuntu. If open-source isn’t a priority, the proprietary NVIDIA drivers are recommended.

Method 2: Install NVIDIA Drivers via RPM Fusion on Fedora

RPM Fusion has long been a favored repository for Fedora users to install NVIDIA drivers. However, being a third-party repository, it might not offer updates as swiftly as the NVIDIA CUDA repository.

To leverage the RPM Fusion repository for NVIDIA driver installation, initiate by integrating the following repositories:

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

With the RPM Fusion repository in place, execute the following to install the latest NVIDIA drivers:

sudo dnf install akmod-nvidia

For those needing CUDA driver support, it can be installed with:

sudo dnf install xorg-x11-drv-nvidia-cuda

Upon completing the installation, reboot your Fedora system. This action will also auto-disable the Nouveau drivers:

sudo reboot

Install NVIDIA Legacy Drivers on Fedora (Situational for Old NVIDIA Cards only)

Legacy drivers are available for users with older NVIDIA cards no longer supported by the latest driver packages. It’s worth noting that these legacy drivers might not receive frequent updates and could have vulnerabilities.

If you have GeForce 600/700 NVIDIA series drivers, run the following command:

sudo dnf install xorg-x11-drv-nvidia-470xx akmod-nvidia-470xx xorg-x11-drv-nvidia-470xx-cuda

The GeForce 400/500 NVIDIA series drivers, run the following command:

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

For GeForce 8/9/200/300 NVIDIA series drivers, run the following command:

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

Method 3: Install NVIDIA Drivers via Runfile on Fedora

The Runfile method offers a manual approach to installing NVIDIA drivers on Fedora Linux. It provides flexibility, allowing you to select any driver version directly from NVIDIA’s official website.

Download the NVIDIA Driver on Fedora

Begin by navigating to the NVIDIA website to download the appropriate driver version for your graphics card. This method’s advantage is the ability to handpick any version, ensuring compatibility with specific needs or applications.

After downloading, the file will typically reside in the ~/Downloads directory, unless you’ve chosen a different download location.

Screenshot of searching for NVIDIA drivers to download from NVIDIA's official website on Fedora Linux
How to search for the right NVIDIA driver for your system on NVIDIA’s official website.
Screenshot showing recommended NVIDIA driver version for download on Fedora Linux
Proceed to download the recommended NVIDIA driver version for your Fedora Linux system.

Disable the Nouveau Drivers

To ensure a smooth installation, you need to disable the Nouveau drivers. Execute the following command in your terminal:

echo -e "blacklist nouveau\noptions nouveau modeset=0" | sudo tee /etc/modprobe.d/blacklist-nouveau.conf

This command performs two primary actions:

  • blacklist nouveau: Prevents the system from auto-loading the Nouveau driver module.
  • options nouveau modeset=0: Disables kernel mode-setting, a method used to set the console’s video mode. This step is crucial when installing proprietary NVIDIA drivers.

Regenerate initramfs and Reboot

Before the changes take effect, regenerate the initramfs:

sudo dracut --force

Switch to CLI mode by disabling the GUI mode:

sudo systemctl set-default multi-user.target

Now reboot using the following command:

sudo reboot

Note: If you miss this step, you can temporarily switch to CLI mode using:

sudo systemctl isolate multi-user.target 

Install the NVIDIA Driver

After rebooting, you’ll be in CLI mode. Navigate to the directory containing the downloaded NVIDIA Runfile:

cd ~/Downloads

Initiate the installation process:

sudo bash NVIDIA-Linux-x86_64-* 

Adjust the command if you’ve downloaded a different version for Fedora.

During the installation, you’ll encounter several prompts:

32-bit Compatibility Libraries: Decide whether to install NVIDIA’s 32-bit Compatibility Libraries. While this is a user choice, installing them can benefit specific applications.

Kernel Module Sources with DKMS: This prompt inquires if you’d like the kernel module sources to register with DKMS. Opting for ‘YES’ ensures that DKMS will auto-build a new module if your kernel updates.

NVIDIA X Driver Configuration: NVIDIA will ask if it should auto-run the nvidia-xconfig utility. This action updates your X configuration file, ensuring the NVIDIA X driver is utilized upon restarting. It also backs up any existing X configuration files. It’s advisable to select ‘YES’ for a seamless experience.

Upon completing these steps, you’ve successfully installed the NVIDIA drivers via the Runfile method on Fedora Linux.

Re-enable GUI and Reboot

Before concluding, switch back to the GUI login:

sudo systemctl set-default graphical.target

Finally, reboot your system:

sudo reboot

Confirming NVIDIA Drivers Installation on Fedora

After installing the NVIDIA drivers on your Fedora system, it’s crucial to ensure that the installation was successful and that the drivers function as expected. This verification step provides confidence in the system’s graphics performance and stability.

Accessing NVIDIA X Server Settings

One straightforward method to verify the NVIDIA driver installation is to access the NVIDIA X Server settings. This graphical interface provides detailed information about the NVIDIA GPU and allows you to adjust various parameters.

To access the NVIDIA X Server settings:

  1. Navigate to “Activities” on your Fedora desktop.
  2. Proceed to “Show Applications.”
  3. Locate and click on “NVIDIA X Server.”

Alternatively, if you prefer using the terminal, you can launch the NVIDIA X Server settings with the following command:

nvidia-settings

Using the Command-Line Interface (CLI)

For those who are more comfortable with the command line or are working on a headless server, the NVIDIA System Management Interface (nvidia-smi) provides a concise overview of the GPU status, driver version, and other pertinent details.

Execute the following command in your terminal:

nvidia-smi

Conclusion

If you are looking for better graphics drivers or your system is not working well with the Nouveau driver, I suggest installing the NVIDIA proprietary drivers. It may take some extra work to get them set up and running correctly, but in my experience, it is worth it.

Joshua James
Follow me

Comments and Feedback

  1. It took a few days, but it looks like there’s an inherent incompatibility between the latest Nvidia drivers (545.23.08-1.fc37) and Linux kernel 6.7.3 on Fedora 39. However, I was just able to install kernel 6.7.4 on FC39 and reinstall the nvidia drivers and that seems to have fixed whatever was broken. Hope this helps others.

    Reply
  2. Not sure when you added the repo for Fedora 39, but as of 6 Feb 24, there’s nothing in there (https://developer.download.nvidia.com/compute/cuda/repos/fedora39/x86_64/). Compare with the repo for Fedora 37 (https://developer.download.nvidia.com/compute/cuda/repos/fedora37/x86_64/). Bottom line, I can install drivers from the Fedora 37 repo, but they don’t seem to work with version 6.7 of the Linux Kernel. I can’t install anything from the Fedora 39 repo.

    Reply

Leave a Comment


en_USEnglish