# Install NVIDIA Drivers on Red Hat Enterprise Linux 9.x

## Introduction

In this article, I'll tell you how to install the NVIDIA GPU drivers on Red Hat Enterprise Linux (RHEL) 9.x

## Check system has an NVIDIA GPU installed

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

```bash
lspci | egrep 'VGA|3D'
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1677302523090/d9cea79b-36e5-4cd4-88a6-5862af0aa1ea.png align="center")

You can see NVIDIA Tesla T4 GPU installed in the system.

## **Install the EPEL Repository**

We 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.

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

```bash
sudo dnf makecache
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1677303451072/daa06b1f-bf50-417a-ac3e-6a8346dec2ca.png align="center")

Enable the official RHEL 9 CodeReady Builder package repository and install it.

Following are the commands to enable and install respectively

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

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

To confirm the installation, press **Y** and then press **&lt;Enter&gt;**

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

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1677304002929/672f62d6-6149-4777-b97d-0577171874eb.png align="center")

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

```bash
sudo dnf makecache
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1677304202324/854280f0-9f06-44e1-8cbf-2e9106246dc4.png align="center")

## **Install 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

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

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1677317082013/f36e3fef-b0e8-4385-84fb-c7ddcb314460.png align="center")

To confirm the installation, press **Y** and then press **&lt;Enter&gt;**.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1677317277048/ff21ba94-8862-4180-9cc0-4f89e4db2f18.png align="center")

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 **&lt;Enter&gt;**.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1677317329454/532c02bd-5838-4cf4-b459-2fc94c97048f.png align="center")

The required dependency libraries and build tools for compiling the NVIDIA kernel module should be installed at this point.

## **Add the Official NVIDIA CUDA Package Repository**

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

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

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1677318761855/dff60a2e-ae3a-46c5-9efb-a2d7c8d8c369.png align="center")

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

```bash
sudo dnf makecache
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1677318908064/002b7458-5493-4884-846f-0076119ff291.png align="center")

## **Install the Latest NVIDIA GPU Drivers**

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

```bash
sudo dnf module install nvidia-driver:latest-dkms
```

To confirm the installation, press **Y** and then press **&lt;Enter&gt;**.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1677320241128/7fc08f20-14ce-4ac2-8c83-5048498f2dcd.png align="center")

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 **&lt;Enter&gt;** to confirm the GPG key.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1677320437644/93677134-8f9e-404d-b126-0158cfbbd2da.png align="center")

NVIDIA GPU drivers should be installed at this point.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1677320504760/1fe09b97-6a29-4038-8db0-30eedab39fea.png align="center")

For the changes to take effect, restart the system with the following command

```bash
sudo reboot
```

## **Verify NVIDIA Drivers are Installed Properly**

Once the system boots, you should see that the proprietary NVIDIA GPU drivers are used with the following command

```bash
lsmod | grep nvidia
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1677320758706/7281322f-08a0-4299-9c7c-54f2b397c703.png align="center")

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

```bash
nvidia-smi
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1677320896269/53b80692-3d33-481a-bce3-8c2108c0b37e.png align="center")

## Conclusion

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