How to install NVIDIA drivers on Rocky Linux 9

This article will cover how to install NVIDIA drivers on Rocky Linux 9.

This is a step by step tutorial.

In order for the driver to install and work correctly you need to disable secure boot, this is by design.

First we need to get EPEL enabled, we can do this with the command below.

sudo dnf install epel-releaseCode language: Bash (bash)

Now we need to add the official NVIDIA repository to our Rocky Linux system, we can do this with the command below.

sudo dnf config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel9/x86_64/cuda-rhel9.repoCode language: Bash (bash)

Its time to get the kernel-devel and kernel-headers used by the drivers.

sudo dnf install kernel-devel-$(uname -r) kernel-headers-$(uname -r)Code language: JavaScript (javascript)

Let’s finally install the NVIDIA drivers.

sudo dnf install nvidia-driver nvidia-settings

To install CUDA drivers, this is optional, you can use the command below.

sudo dnf install cuda-driver

You will need to reboot in order for this change to take an effect.

After the reboot you can enter the command below to check if the drivers work, if it shows you GPU information that means the drivers work, if this errors out it means the drivers have failed to load

nvidia-smi

If you found this guide helpful or come across any issues or error leave a comment below. I will be happy to help and reply as soon as I can.