How to Install Nvidia Drivers on AlmaLinux EL9 or EL8

Nvidia drivers represent the forefront of graphics processing technology, providing robust and advanced features that ensure optimum performance for various applications, from video gaming and editing to scientific computing and AI research. In contrast, the default Nouveau drivers bundled with AlmaLinux offer basic functionality but lack Nvidia’s proprietary drivers’ high-performance capabilities and advanced feature support. The following guide will demonstrate how to install Nvidia Drivers on AlmaLinux for the Enterprise Linux 9 and the older stable Enterprise 8 release series.

The comparative advantages of Nvidia’s proprietary drivers over Nouveau can be broadly classified into Performance and Features and Support and Stability:

Performance and Features

  • Efficiency: Nvidia’s drivers are fine-tuned to extract maximum performance from their GPUs, offering significantly higher efficiency than the open-source Nouveau drivers.
  • Advanced Feature Support: Nvidia’s drivers support a broad spectrum of advanced features like CUDA for GPU-accelerated computing, NVENC for hardware-accelerated video encoding, and G-SYNC for smooth, tear-free gaming.
  • Optimized Software Compatibility: Many software developers optimize their applications specifically for Nvidia’s proprietary drivers, ensuring seamless integration and improved performance.

Support and Stability

  • Continual Updates: Nvidia frequently updates its drivers, introducing performance improvements, bug fixes, and new features.
  • Reliable Support: Nvidia offers professional support for their drivers, ensuring any issues encountered can be swiftly addressed.
  • Stability: Nvidia’s proprietary drivers are generally more stable than Nouveau, especially for newer GPUs.

Given the abovementioned reasons, AlmaLinux users with Nvidia GPUs may find replacing the default Nouveau drivers with Nvidia’s proprietary versions beneficial. It’s important to note that installing the drivers directly from Nvidia’s RPM repository ensures you’re getting the latest, most compatible version for your specific GPU and OS version. Now, let’s move on to installing the graphic drivers on AlmaLinux.

Section 1: Nvidia Drivers Installation Prerequisites on AlmaLinux

Step 1: Update the AlmaLinux System Before Nvidia Drivers Installations

Any installation process should ideally be preceded by updating your system. An updated system minimizes the possibility of encountering conflicts caused by outdated packages during the installation. You can perform a system update using the following command:

sudo dnf upgrade --refresh

Step 2: Determine the Installed Nvidia Graphics Card on AlmaLinux

In the next step, it is beneficial to identify the specific Nvidia Graphics card that your system is equipped with. This knowledge aids in verifying compatibility and assuring a smooth installation process. However, users with newer graphics card models can bypass this step, as more recent models are commonly supported.

The command to identify your graphics card model is:

lspci | grep -e VGA

An exemplary output might look like this:

03:00.0 VGA compatible controller: NVIDIA Corporation TU117 [GeForce GTX 1650] (rev a1)

If your system hosts an older graphics card, it is advisable to visit Nvidia’s official website to check compatibility. Installing legacy drivers might be necessary for older cards no longer supported by the latest Nvidia drivers.

Step 3: Check the Secure Boot Status on AlmaLinux

If secure boot is enabled on your system, you might experience difficulties during the Nvidia driver installation. In such scenarios, you may need to turn off the secure boot or undertake additional measures to circumvent conflicts. Consequently, checking the secure boot status is a crucial step.

The command to check if secure boot is enabled is as follows:

mokutil --sb-state

This command will display the status of the secure boot on your terminal. Depending on this output and your system configuration, you might need to adjust your setup. For any issues related to secure boot, refer to your system documentation or the relevant troubleshooting guides.

Section 2: Integrating the EPEL Repository into AlmaLinux

Step 1: Establishing the EPEL Repository

The initial step for setting up Nvidia drivers on AlmaLinux includes incorporating the EPEL repository. It’s beneficial to have both repositories for the best results. Furthermore, ensuring that the chosen EPEL repository aligns with your specific AlmaLinux distribution is vital.

Configuring EPEL for AlmaLinux 9

Your first task involves activating the CodeReady Builder (CRB). You can achieve this by executing the following command:

sudo dnf config-manager --set-enabled crb

With the CRB activated, you’re now prepared to install both versions of the EPEL. You can accomplish this by running the command below:

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

Configuring EPEL for AlmaLinux 8

To set up the EPEL for AlmaLinux 8, you can employ the following command:

sudo dnf install \
    https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm \
    https://dl.fedoraproject.org/pub/epel/epel-next-release-latest-8.noarch.rpm

These steps involve activating and incorporating an additional repository of software packages into your AlmaLinux distribution. This process expands the range of software you can install while ensuring compatibility with your specific version of AlmaLinux, such as the case with installing the Nvidia Drivers packages.

Section 3: Installing Nvidia Drivers on AlmaLinux

Step 1: Incorporating Nvidia Drivers RPM on AlmaLinux

The forthcoming procedure necessitates installing the Nvidia drivers repository, sourced directly from Nvidia. This approach is advantageous as it provides immediate access to the latest updates.

It’s crucial to ensure the compatibility of the repository with your specific AlmaLinux distribution while integrating it into your system.

Importing Nvidia Repository RPM for AlmaLinux 9

Execute the command below to integrate the Nvidia repository into AlmaLinux 9:

sudo dnf config-manager --add-repo http://developer.download.nvidia.com/compute/cuda/repos/rhel9/$(uname -i)/cuda-rhel9.repo

Adding Nvidia Repository RPM for AlmaLinux 8

For AlmaLinux 8, the command alters slightly as follows:

sudo dnf config-manager --add-repo http://developer.download.nvidia.com/compute/cuda/repos/rhel8/$(uname -i)/cuda-rhel8.repo

Following the repository’s integration, installing the required dependencies is recommended. While some of these might already be installed, executing the command below ensures their presence:

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

Once this is done, proceed to integrate the latest Nvidia drivers using the following:

sudo dnf module install nvidia-driver:latest-dkms
Screenshot of terminal output during Nvidia driver installation on AlmaLinux.Pin
Terminal screenshot showing the Nvidia driver installation process on AlmaLinux EL9 or EL8.

Alternatively, Nvidia RPM modules can be listed using the command:

sudo dnf module list nvidia-driver
Screenshot of terminal listing modules for DKMS or open-source Nvidia drivers on AlmaLinux.Pin
Terminal screenshot displaying modules associated with DKMS or open-source Nvidia drivers on AlmaLinux EL9 or EL8.

If you’re an open-source user, you might consider installing this module instead of the proprietary one. However, feedback suggests open-source users may run into bugs depending on the graphics card. If this happens, switch to the proprietary drivers, which typically resolves the issue.

For instance:

sudo dnf module install nvidia-driver:open-dkms

Upon successful completion, a system restart is necessary. Execute the command:

reboot

Section 4: Verifying the Nvidia Drivers Installation on AlmaLinux

Execution of the NVIDIA-SMI Command

To confirm the successful installation of the Nvidia drivers, you need to execute the NVIDIA-SMI command. This command should produce an output that indicates a successful installation. You can run this command as follows:

nvidia-smi

The following is a placeholder for an image, giving you an example of what your output might look like upon a successful installation:

Screenshot of Nvidia SMI command output confirming driver installation on AlmaLinux.Pin
Terminal screenshot showing Nvidia SMI command output, confirming successful Nvidia driver installation on AlmaLinux EL9 or EL8.

Accessing Nvidia Settings

Another method for verifying the installation involves accessing the Nvidia settings graphical user interface (GUI). This can be done either from the application icon menu or by executing the following command:

nvidia-settings

Locating the GUI Application Icon

There’s also an option to verify the installation by locating the GUI application icon. You can achieve this by navigating the path Activities > Show Applications > NVIDIA X SERVER in the application menu.

Below is a placeholder for an image illustrating what a successful Nvidia driver installation should look like:

Screenshot of Nvidia Settings GUI window on AlmaLinux.Pin
Graphical user interface screenshot displaying Nvidia settings on AlmaLinux EL9 or EL8.

As of the time of writing this tutorial, NVIDIA 535 is the latest version. By installing directly from the Nvidia repository, you should see that this version is installed. However, remember that this version number may change quickly as time progresses, but the process remains the same.

Section 5: Resolving Issues: Step-by-Step Guide to Troubleshooting

Handling Secure Boot Challenges with Nvidia Driver Installation

If you are experiencing problems due to Secure Boot after installing the Nvidia drivers, these steps may provide a resolution without requiring you to disable Secure Boot.

Disabling Nouveau Drivers

Conflicts may arise between Nouveau and Nvidia drivers. Therefore, you should prevent these conflicts by blacklisting Nouveau drivers. To do this, execute the following commands:

echo "blacklist nouveau" | sudo tee /etc/modprobe.d/blacklist-nouveau.conf
echo 'omit_drivers+=" nouveau "' | sudo tee /etc/dracut.conf.d/blacklist-nouveau.conf

Upon completing these modifications, regenerate all Dracut initramfs images and update the module dependency list using the following commands:

sudo dracut --regenerate-all --force
sudo depmod -a

Enabling Secure Boot

If Secure Boot is enabled on your system, it’s necessary to import the Machine Owner Key (MOK) public key, which signs the Nvidia kernel module. To accomplish this, utilize the mokutil command as shown:

sudo mokutil --import /var/lib/dkms/mok.pub

The mokutil command will prompt you to create a password, which will be required when your system reboots.

Next, proceed to reboot your system:

sudo reboot

During the reboot, your system may request key enrollment. Accept this request and input the password you generated with the mokutil command.

Validating the Driver Installation

To ascertain that the Nvidia drivers are successfully installed, execute the nvidia-smi command:

nvidia-smi

Troubleshooting Post-Windows Update

A firmware update might reset the TPM chip in a dual-boot environment with Windows. In such a situation, you must re-import the Machine Owner Key (MOK). To rectify this, rerun the mokutil command:

sudo mokutil --import /var/lib/dkms/mok.pub

These instructions offer a detailed guide to troubleshooting and resolving any potential issues you may encounter while installing the Nvidia drivers on AlmaLinux.

Conclusion

Our exploration into installing Nvidia drivers on AlmaLinux has proven to be insightful. We have walked through the necessary steps, ensuring clarity at every stage, from verifying the Nvidia drivers’ successful installation to troubleshooting potential issues. This process enhances your system’s graphics capabilities and overall computing experience.

As a parting recommendation, remember to keep your drivers updated to ensure optimal performance. Regular updates typically offer enhancements and bug fixes, which can substantially increase your system’s stability and efficiency.

Share to...