Most modern Linux Desktop systems such as AlmaLinux come with an NVIDIA driver pre-installed in the Nouveau open-source graphics device driver for Nvidia video cards. For the most part, this is acceptable; however, if you are using your Linux system for graphical design or gaming, you may get better drivers.
Historically, the Nouveau proprietary drivers are slower than Nvidia’s, which lacks the latest graphics card hardware features, software technology, and support. In most situations, upgrading your Nvidia Drivers with proper NVIDIA drivers is more beneficial than not. In some cases, you may see some substantial improvements overall.
In the following tutorial, you will learn how to install the Nvidia Graphic Drivers from the Nvidia Proprietary Repository RPM Fusion, giving you the latest software on AlmaLinux 9, the command line terminal.
Table of Contents
Update AlmaLinux
Before you begin, update your system to ensure all existing packages are up to date to avoid conflicts. This is essential when installing drivers such as graphic card drivers and kernels, etc.
sudo dnf upgrade --refresh
Install EPEL/EPEL Next Repository
The first task is to install the EPEL repository, and the recommendation is to install both repositories.
First, enable the CRB repository.
sudo dnf config-manager --set-enabled crb
Next, install EPEL using the following (dnf) terminal command.
sudo dnf install \
https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm \
https://dl.fedoraproject.org/pub/epel/epel-next-release-latest-9.noarch.rpm
Install RPM Fusion Repository
The tutorial will now import the RPM Fusion repository, which often has the most up-to-date Nvidia driver support; optionally, you can install the testing repository for those that prefer to get updates even quicker.
First, open your terminal and add the following repositories
Import RPM Fusion Free
sudo dnf install --nogpgcheck https://mirrors.rpmfusion.org/free/el/rpmfusion-free-release-$(rpm -E %rhel).noarch.rpm -y
Import RPM Fusion Nonfree (Contains Nvidia Drivers)
sudo dnf install https://mirrors.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-$(rpm -E %rhel).noarch.rpm -y
Optional – Enable RPM Fusion TESTING Branch
RPM Fusion has a testing branch that contains mostly incoming new release NVIDIA driver series packages or beta packages. This can be useful for those who want to install bleeding-edge NVIDIA drivers.
First, enable the RPM Fusion Testing repository using the following command.
Enable the Free Repository
sudo dnf config-manager --set-enabled rpmfusion-free-updates-testing
Enable the Non-Free Repository
sudo dnf config-manager --set-enabled rpmfusion-nonfree-updates-testing
Once enabled, proceed to install the drivers or run an update. If new bleeding-edge drivers in a test or, more likely, beta drivers will appear here, and you can begin to update to these, remember they may be buggy, so do not be surprised.
Sometimes you may want to disable the RPM Fusion testing repository. This can be quickly done by using the following command, to re-enable, use the following commands above and rinse and repeat.
Disable the Free Repository
sudo dnf config-manager --set-disabled rpmfusion-free-updates-testing
Disable the Non-Free Repository
sudo dnf config-manager --set-disabled rpmfusion-nonfree-updates-testing
Install NVIDIA Drivers
Now that you have imported the RPM Fusion repository execute the following command to install the latest Nvidia drivers on your system.
sudo dnf install akmod-nvidia
Next, install the CUDA driver support. Ideally, you may not need this, but sometimes if issues persist, installing the CUDA support can solve problems.
sudo dnf install xorg-x11-drv-nvidia-cuda
Note the NVIDIA-SMI command is only useable with Cuda support.
Once everything has been installed, you must restart your system. By default, this will also disable Nouveau drivers automatically.
reboot
Verify NVIDIA Drivers Installation
Once you have returned, view the NVIDIA X Server Settings by using the following path.
Activities > Show Applications > NVIDIA X Server
Alternatively, if you opened a terminal, use the following command.
nvidia-settings
Example if installation successful:
Users who installed Cuda support can run the following command in your terminal.
nvidia-smi
Example output:
How to Update Nvidia Drivers
All future updates will be in the standard dnf refresh command procedure, and this will check the RPM Fusion repository for updates and the rest of your AlmaLinux packages.
sudo dnf upgrade --refresh
How to Remove Nvidia Drivers and RollBack
If you do not want to continue to use the Nvidia official drivers, use the following command:
sudo dnf autoremove akmod-nvidia xorg-x11-drv-nvidia-cuda -y
This will remove all dependencies installed, and once removed, you must reboot.
reboot
During the reboot, the process will re-enable the Nouveau drivers. You will see a message stating Nvidia drivers not found re-enabling Nouveau drivers, making it easier to switch back and forth if needed.
Comments and Conclusion
In the tutorial, you have learned how to install the Nvidia Drivers on your workstation desktop. Overall, these drivers from RPM Fusion are the most effective, stable, and safest method compared to manually downloading and installing .run files for users that prefer to keep their system stable.
For users looking for older Nvidia Driver support, currently, in RPM Fusion, this does not exist compared to other streams for Fedora, but given EL 9 is still new at the time of this tutorial, this support should eventually be added to the repositories.