Red Hat Linux

Install NVIDIA Drivers on Red Hat Enterprise Linux (RHEL) 9

“If you have installed Red Hat Enterprise Linux (RHEL) 9 on your computer and also have an NVIDIA GPU installed on your computer, installing the NVIDIA GPU drivers on Red Hat Enterprise Linux (RHEL) 9 is the first thing you would want to do.

In this article, I will show you how to install the latest version of the proprietary NVIDIA GPU drivers on Red Hat Enterprise Linux (RHEL) 9. So, let’s get started.”

Table of Contents

  1. Checking if the System Has Any NVIDIA GPU Installed
  2. Disable Secure Boot from the BIOS
  3. Enabling the EPEL Repository on RHEL 9
  4. Installing the Required Dependencies and Build Tools for Compiling NVIDIA Kernel Modules
  5. Adding the Official NVIDIA CUDA Package Repository on RHEL 9
  6. Installing the Latest NVIDIA GPU Drivers on RHEL 9
  7. Checking If NVIDIA Drivers are Installed Properly
  8. Conclusion
  9. References

Checking if the System has any NVIDIA GPU Installed

You can check whether your computer has an NVIDIA GPU installed with the following command:

$ lspci | egrep 'VGA|3D'

As you can see, I have an NVIDIA GeForce GTX 1050 Ti GPU installed on my computer. You may have a different NVIDIA GPU installed.

By default, the open-source Nouveau GPU drivers are used1 instead of the proprietary NVIDIA GPU drivers2 on RHEL 9. Once you install the proprietary NVIDIA GPU drivers, you will see that they are used instead of the open-source Nouveau GPU drivers.

$ lsmod | grep nouveau
$ lsmod | grep nvidia

Disable Secure Boot From the BIOS

For NVIDIA GPU drivers to work on RHEL 9, you must disable secure boot from the BIOS of your motherboard if it uses the UEFI firmware for booting operating systems.

The process of disabling secure boot from the BIOS of UEFI-capable motherboards is vendor-specific (different for each motherboard vendor like ASUS, MSI, Gigabyte, AsRock, etc.). So, it’s best to check the user manual of your motherboard to find out how to disable secure boot on your motherboard.

For older BIOS-based motherboards, you don’t need to do anything for the NVIDIA GPU drivers to work on RHEL 9.

Enabling the EPEL Repository on RHEL 9

To install the NVIDIA GPU drivers on RHEL 9, you will have to install the required build tools and the required dependency libraries for compiling the NVIDIA kernel modules. Some of these are available in the RHEL 9 EPEL repository. In this section, I am going to show you how to enable the EPEL repository on RHEL 9.

First, update the DNF package repository cache with the following command:

$ sudo dnf makecache

Enable the official RHEL 9 CodeReady Builder package repository with the following command:

$ sudo subscription-manager repos --enable codeready-builder-for-rhel-9-$(uname -i)-rpms

Install the epel-release package from the official website of Fedora with the following command:

$ sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm

To confirm the installation, press Y and then press <Enter>.

The epel-release package should be installed, and the EPEL repository should be enabled.

For the changes to take effect, update the DNF package repository cache with the following command:

$ sudo dnf makecache

Installing the Required Dependencies and Build Tools for Compiling NVIDIA Kernel Modules

To install the required build tools and dependency libraries for compiling the NVIDIA kernel modules on RHEL 9, run the following command:

$ sudo dnf install kernel-devel-$(uname -r) kernel-headers-$(uname -r) gcc make dkms acpid libglvnd-glx libglvnd-opengl libglvnd-devel pkgconfig

To confirm the installation, press Y and then press <Enter>.

The required packages are being downloaded from the internet. It will take a while to complete.

Once the packages are downloaded, you will be asked to confirm the GPG key of the EPEL repository.

To confirm the GPG key, press Y and then press <Enter>.

To confirm the GPG key of the official RHEL package repository, press Y and then press <Enter>.

To confirm another GPG key of the official RHEL package repository, press Y and then press <Enter>.

The installation should continue.

At this point, the required dependency libraries and build tools for compiling the NVIDIA kernel module should be installed on RHEL 9.

Adding the Official NVIDIA CUDA Package Repository on RHEL 9

To add the official NVIDIA CUDA package repository on RHEL 9, run the following command:

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

For the changes to take effect, update the DNF package repository cache with the following command:

$ sudo dnf makecache

Installing the Latest NVIDIA GPU Drivers on RHEL 9

To install the latest version of the NVIDIA GPU drivers on RHEL 9, run the following command:

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

To confirm the installation, press Y and then press <Enter>.

NVIDIA GPU drivers packages and the required dependency packages are being downloaded from the internet. It will take a while to complete.

Once the packages are downloaded, you will be asked to confirm the GPG key of the official NVIDIA package repository. Press Y and then press <Enter> to confirm the GPG key.

The installation should continue. It will take a while to complete.

At this point, NVIDIA GPU drivers should be installed.

For the changes to take effect, restart your computer with the following command:

$ sudo reboot

Checking If NVIDIA Drivers are Installed Properly

Once your computer boots, you should see that the proprietary NVIDIA GPU drivers are used1 instead of the open-source Nouveau GPU drivers2.

$ lsmod | grep nvidia
$ lsmod | grep nouveau

You should also find the NVIDIA X Server Settings app in the Application Menu of RHEL 9. Click on it.

The NVIDIA X Server Settings app should run without any errors, and it should show a lot of information related to your installed NVIDIA GPU.

You should also be able to run the NVIDIA command-line programs like nvidia-smi.

$ nvidia-smi

Conclusion

In this article, I have shown you how to add the official NVIDIA CUDA repository on RHEL 9. I have also shown you how to install the latest version of the proprietary NVIDIA GPU drivers on RHEL 9.

References

  1. Extra Packages for Enterprise Linux (EPEL) :: Fedora Docs (fedoraproject.org)
  2. NVIDIA Driver Installation Quickstart Guide :: NVIDIA Tesla Documentation

About the author

Shahriar Shovon

Freelancer & Linux System Administrator. Also loves Web API development with Node.js and JavaScript. I was born in Bangladesh. I am currently studying Electronics and Communication Engineering at Khulna University of Engineering & Technology (KUET), one of the demanding public engineering universities of Bangladesh.