Here is how to install the official Nvidia drivers on Rocky Linux and it works flawlessly.

This works best on the default kernel that ships with Rocky Linux, if you have a custom Kernel or modified setup, there might be a need for extra steps. The extra steps are out of the scope of this article.

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

Let’s get straight into it. (The step speed may vary depending on your internet connection)

Step 1. We need to get Epel.

sudo dnf install epel-release

Step 2. Adding the official Nvidia drivers repository to our package managers repository list.

sudo dnf config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel8/x86_64/cuda-rhel8.repoCode language: JavaScript (javascript)

Step 2. Installing the kernel-devel and headers used by the drivers.

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

Step 3. Installing Nvidia drivers and settings applications.

The command below will download the latest stable driver available.

sudo dnf install nvidia-driver nvidia-settings

Step 4. Installing CUDA drivers. (This is optional but recommended)

sudo dnf install cuda-driver

Step 5. Reboot your system.

Step 6. Verify that it is working by running nvidia-smi

nvidia-smi

The nvidia-smi command should display information about your graphics card, if this command fails to show the details or throws an error after the command is entered, it means that the driver did not install correctly.

To remove the drivers completely.

Run the command below.

sudo dnf remove nvidia-driver nvidia-settings cuda-driver kernel-devel-$(uname -r) kernel-headers-$(uname -r)Code language: JavaScript (javascript)

Continue the discussion on Reddit.

Thank you for reading, leave a comment, and let me know what you think about this article.

I compiled a list of software and services that I use to improve my workflow, here is the link to the list.

Darryl Dias

I’m Darryl. I’m a 3D Artist, Programmer and Linux enthusiast. On this site I share my insights, tips and tricks, tutorials, methods and best practices.