Installing NVIDIA drivers on Fedora is essential for users who want to maximize the performance of their NVIDIA GPUs, whether for gaming, 3D rendering, or CUDA-based tasks. Several methods are available for installing these drivers, each with its own advantages.
One option is using the NVIDIA CUDA RPM repository, which provides drivers specifically optimized for CUDA development, although it often lags behind the latest Fedora releases. Another common method is installing drivers via RPM Fusion, a third-party repository that offers up-to-date NVIDIA drivers with seamless integration into Fedora’s kernel, making it a popular and reliable choice. For users who require the very latest drivers, manually downloading and installing the NVIDIA driver runfile directly from NVIDIA’s website is often the best option, providing the most control and customization, though it involves a more manual setup process.
This guide will walk you through each of these methods, helping you choose the one that best suits your needs on Fedora 40 or 39.
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
Method 1: Install NVIDIA Drivers via NVIDIA Cuda RPM
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 system.
Import Nvidia CUDA Repository for Fedora 40:
Note: Nvidia did not make Fedora 40 branch drivers. You will need to try either RPM Fusion or the .runfile installation methods until it is available.
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
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 that are 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
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.
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
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:
- Navigate to “Activities” on your Fedora desktop.
- Proceed to “Show Applications.”
- 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 more comfortable with the command line or 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
With the NVIDIA drivers installed on your Fedora system, you can fully harness the power of your GPU for various high-performance tasks. The RPM Fusion method provides a balanced approach with current drivers and easy updates, while the NVIDIA CUDA RPM repository is geared towards CUDA developers. For those needing the most recent driver versions, manual installation via the NVIDIA runfile offers the greatest flexibility, though it requires more effort. Keeping your drivers updated ensures optimal compatibility and performance with your Fedora setup.
The runfile method defaults only to using xorg, not wayland, which is not a smooth experience. Is there a way to enable wayland in Fedora 40? So far all my attempts have been unsuccessful.
Hello,
I recently bought 4070 TI super, but I can’t install the driver. I’ve tried the 3 methods and others as well, but nothing works. I’ve read on forums that other people also have problems installing the driver for 4070 TI super. I would like to ask for your advice. It’s true that I’m not a Linux expert, but I spend my time looking for a solution without success.
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.
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.
Method 1 worked for me
Rtx 3050
great work
thanks a lot