How to Install Nvidia Drivers on Rocky Linux

NVIDIA drivers connect your graphics card to the Rocky Linux operating system, enabling hardware-accelerated rendering for gaming, professional visualization, and GPU-compute workloads like machine learning and scientific simulations. This guide walks through installing NVIDIA drivers from the official NVIDIA CUDA repository, which provides the most current driver releases with direct vendor support.

By the end of this guide, you will have working NVIDIA drivers with GPU acceleration enabled, verified through the nvidia-smi utility. The installation covers both the proprietary drivers (recommended for most users) and the open-source kernel modules for those who prefer them.

These instructions work on Rocky Linux 8, 9, and 10. The installation method differs between versions: Rocky Linux 8 and 9 use DNF module streams, while Rocky Linux 10 uses standard package installation because NVIDIA deprecated modularity support. Where commands differ, each version has its own section.

Choose Your NVIDIA Driver Option

NVIDIA provides both proprietary drivers and open kernel modules in the CUDA repository. Use the table below to pick the best fit before installing.

FeatureProprietary driversOpen kernel modules
Kernel module typeClosed-source NVIDIA kernel modulesOpen-source kernel modules with NVIDIA user-space libraries
GPU supportAll supported NVIDIA GPUsTuring and newer GPUs only
Feature coverageFull feature set and best compatibilityMay have limitations on some features or workloads
Recommended forMost desktop and workstation usersUsers who require open-source kernel modules

Recommended for most users: Install the proprietary drivers for the widest hardware support and the fewest surprises. Choose the open kernel modules only if you need open-source kernel modules and your GPU is Turing or newer.

Prepare Your System for NVIDIA Driver Installation

Update Rocky Linux Packages

First, update your existing packages to avoid conflicts from outdated libraries or kernel mismatches. The following command refreshes the repository metadata and upgrades all installed packages:

sudo dnf upgrade --refresh

If this process updates the kernel, reboot your system before continuing. The NVIDIA driver installer needs kernel headers that match your running kernel, so a reboot ensures consistency.

Identify Your Graphics Card

Next, confirm that your system has an NVIDIA GPU and note the model for driver compatibility. The lspci command lists all PCI devices, and grep filters for VGA or 3D controllers (see our grep command guide if you want more filtering options):

lspci | grep -E "VGA|3D"

For example, this output shows an NVIDIA GeForce GTX 1650:

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

If your card is from the GeForce 700 series or older, you may need legacy drivers instead of the latest branch. Check the NVIDIA Unix driver archive to confirm which driver version supports your GPU.

If lspci is missing, install the pciutils package first:

sudo dnf install pciutils -y

Check Secure Boot Status

Finally, check your Secure Boot status. Secure Boot can prevent unsigned kernel modules from loading, which affects NVIDIA driver installation. Use the mokutil command to check:

mokutil --sb-state

If the command is missing, install mokutil first:

sudo dnf install mokutil -y

When Secure Boot is enabled, you will see:

SecureBoot enabled

Alternatively, when Secure Boot is disabled:

SecureBoot disabled

With Secure Boot enabled, you will need to sign the NVIDIA kernel module or import the Machine Owner Key (MOK) after installation. The troubleshooting section below covers this process.

Install EPEL and Enable Required Repositories

The NVIDIA driver installation requires packages from EPEL (Extra Packages for Enterprise Linux), including dkms for kernel module builds on Rocky Linux 8, 9, and 10. CRB (CodeReady Builder) or PowerTools is disabled by default and is only needed if a dependency install complains about missing packages.

Rocky Linux 10

On Rocky Linux 10, install the config-manager plugin used later to add the NVIDIA repository, then add EPEL:

sudo dnf install dnf-plugins-core -y
sudo dnf install epel-release -y

Rocky Linux 9

Similarly, Rocky Linux 9 provides EPEL through the extras repository. Install the config-manager plugin, then add EPEL:

sudo dnf install dnf-plugins-core -y
sudo dnf install epel-release -y

Rocky Linux 8

For version 8, the repository uses the name PowerTools instead of CRB. Install the plugin, then add EPEL:

sudo dnf install dnf-plugins-core -y
sudo dnf install epel-release -y

For more details on EPEL configuration and available packages, see our EPEL installation guide for Rocky Linux.

Add the NVIDIA CUDA Repository

Next, add the NVIDIA CUDA repository. NVIDIA maintains official RPM repositories for RHEL and compatible distributions like Rocky Linux, giving you access to the latest driver releases, CUDA toolkit, and related packages.

Rocky Linux 10

For version 10, use the RHEL 10 repository:

sudo dnf config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel10/x86_64/cuda-rhel10.repo

Rocky Linux 9

On version 9, use the RHEL 9 repository:

sudo dnf config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel9/x86_64/cuda-rhel9.repo

Rocky Linux 8

Finally, version 8 uses the RHEL 8 repository:

sudo dnf config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel8/x86_64/cuda-rhel8.repo

Once you add the repository, DNF will prompt you to import the NVIDIA GPG key during the first package installation. Type y to accept the key import.

Install Build Dependencies

With the repositories configured, install the kernel headers and development tools. The NVIDIA repository uses DKMS-based kmod packages on Rocky Linux 8, 9, and 10, so these dependencies are required for both proprietary and open kernel modules:

sudo dnf install kernel-headers kernel-devel gcc make dkms acpid libglvnd-glx libglvnd-opengl libglvnd-devel pkgconf-pkg-config -y

This command installs:

  • kernel-headers and kernel-devel – Required for DKMS to compile kernel modules (Rocky 8/9/10)
  • gcc and make – Build toolchain for compilation
  • dkms – Dynamic Kernel Module Support, rebuilds modules after kernel updates (Rocky 8/9/10)
  • acpid – Power management daemon for GPU power events
  • libglvnd-* – Vendor-neutral OpenGL dispatch library
  • pkgconf-pkg-config – Provides the pkg-config command used by build scripts

If the dependency install fails with missing packages, enable CRB or PowerTools for your release and rerun the dependency command:

Rocky Linux 10:

sudo dnf config-manager --set-enabled crb

Rocky Linux 9:

sudo dnf config-manager --set-enabled crb

Rocky Linux 8:

sudo dnf config-manager --set-enabled powertools

For detailed information about kernel headers on Rocky Linux, see our kernel headers installation guide.

Install NVIDIA Drivers

Now you can install the NVIDIA drivers. The installation method differs between Rocky Linux versions because version 10 deprecates DNF modularity.

Rocky Linux 8 and 9: Module Installation

Rocky Linux 8 and 9 use DNF module streams to manage NVIDIA driver versions. The latest-dkms stream installs the newest driver with DKMS support for automatic kernel module rebuilding:

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

You can also view all available driver streams, including legacy versions for older GPUs:

sudo dnf module list nvidia-driver

This command displays the available streams:

Name          Stream        Profiles                 Summary
nvidia-driver latest        default [d], fm, ks      Nvidia driver for latest branch
nvidia-driver latest-dkms   default [d], fm, ks      Nvidia driver for latest-dkms branch
nvidia-driver open-dkms [d] default [d], fm, ks      Nvidia driver for open-dkms branch
nvidia-driver 515           default [d], fm, ks, src Nvidia driver for 515 branch
nvidia-driver 515-dkms      default [d], fm, ks      Nvidia driver for 515-dkms branch
nvidia-driver 515-open      default [d], fm, ks, src Nvidia driver for 515-open branch
nvidia-driver 520           default [d], fm, ks, src Nvidia driver for 520 branch

Alternatively, if you prefer the open-source NVIDIA kernel modules (available for Turing and newer GPUs), you can install the open-dkms stream instead:

sudo dnf module install nvidia-driver:open-dkms -y

The open-source kernel modules may have compatibility issues with some GPUs and features. If you experience problems such as display artifacts or crashes, switch to the proprietary drivers by resetting the module and reinstalling: sudo dnf module reset nvidia-driver && sudo dnf module install nvidia-driver:latest-dkms -y

Rocky Linux 10: Proprietary DKMS Packages

Because Rocky Linux 10 deprecates DNF modularity, you install NVIDIA drivers as regular packages instead. Use the command below to install the proprietary driver stack and the proprietary DKMS kernel module:

sudo dnf install kmod-nvidia-latest-dkms nvidia-driver nvidia-driver-libs nvidia-driver-cuda -y

This command installs the proprietary NVIDIA driver along with CUDA support libraries. Driver versions change frequently, so rely on the verification step below to confirm the exact version installed.

You can also check which driver packages are available:

dnf search nvidia-driver

If you plan to use the NVIDIA Settings GUI on Rocky Linux 10, install it now:

sudo dnf install nvidia-settings -y

Rocky Linux 10: Open Kernel Modules (Turing and Newer)

If you need the open-source kernel modules and your GPU is Turing or newer, install the nvidia-open package. It pulls in the standard NVIDIA user-space stack and the open DKMS module:

sudo dnf install nvidia-open -y

Reboot to Load the Driver

Once the installation completes, reboot your system to load the NVIDIA kernel module and initialize the GPU:

sudo reboot

Verify the Installation

Once your system reboots, confirm that the NVIDIA driver loaded correctly by running the nvidia-smi utility:

nvidia-smi

When the driver loads successfully, you will see output displaying the driver version, GPU model, memory usage, and running processes:

+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 590.xx.xx              Driver Version: 590.xx.xx    CUDA Version: 12.x    |
|-----------------------------------------+------------------------+-------------------+
| GPU  Name                 Persistence-M | Bus-Id          Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |           Memory-Usage | GPU-Util  Compute M. |
|=========================================+========================+===================|
|   0  NVIDIA GeForce GTX 1650       Off  | 00000000:03:00.0   On |                  N/A |
| 35%   42C    P8              N/A /  75W |     245MiB /  4096MiB |      2%      Default |
+-----------------------------------------+------------------------+-------------------+

NVIDIA driver and CUDA versions change frequently. Your nvidia-smi output will show the current release installed from the NVIDIA repository.

Additionally, if you have a desktop environment installed, you can launch the NVIDIA X Server Settings application for graphical configuration:

nvidia-settings

This utility displays detailed GPU information, allows display configuration, and provides access to performance settings.

Rocky Linux 10 runs GNOME in Wayland-only mode. The nvidia-settings application requires X11 and runs via XWayland, which may limit some features. Full GNOME X11 sessions are not available on Rocky Linux 10.

Update NVIDIA Drivers

NVIDIA releases driver updates regularly with bug fixes, security patches, and new GPU support. To update your drivers, use the standard DNF upgrade command:

sudo dnf upgrade --refresh

This command upgrades all packages including NVIDIA drivers when new versions become available in the repository. After updating, reboot to load the new kernel module.

You can check your currently installed driver version with:

nvidia-smi --query-gpu=driver_version --format=csv,noheader

Example output:

590.xx.xx

Troubleshooting Common Issues

NVIDIA driver installation can sometimes encounter issues related to Secure Boot, the Nouveau driver, or kernel module loading. The following sections cover common problems along with diagnostic commands and solutions.

Nouveau Driver Conflicts

The open-source Nouveau driver ships with Rocky Linux and loads automatically for NVIDIA GPUs. Because it conflicts with the proprietary NVIDIA driver, you must block it from loading.

First, check if Nouveau is currently loaded:

lsmod | grep -i nouveau || echo "nouveau not loaded"

When output appears, Nouveau is active. A typical line looks like this:

nouveau              2252800  0

If you see nouveau not loaded, the module is already inactive and you can skip to the next section. Otherwise, create configuration files to block it from loading:

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

Next, regenerate the initramfs to apply the block configuration:

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

Then reboot and verify that Nouveau no longer loads:

sudo reboot

After rebooting, run the check again. When you see nouveau not loaded, the block configuration is working correctly:

lsmod | grep -i nouveau || echo "nouveau not loaded"
nouveau not loaded

Secure Boot Preventing Driver Loading

When Secure Boot is enabled, the NVIDIA kernel module may fail to load because the system does not recognize its signature. You will see errors like:

modprobe: ERROR: could not insert 'nvidia': Key was rejected by service

First, check whether the NVIDIA module loaded:

lsmod | grep nvidia

When the output is empty and Secure Boot is enabled, you need to import the Machine Owner Key (MOK) that DKMS uses to sign the module. First, verify the DKMS public key exists:

ls -la /var/lib/dkms/mok.pub
-rw-r--r-- 1 root root 1679 Jan  8 11:20 /var/lib/dkms/mok.pub

Then import the key into the MOK database:

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

The command prompts you to create a one-time password. Remember this password because you will need it during the next step.

Next, reboot your system:

sudo reboot

During boot, the MOK Manager utility appears. Select “Enroll MOK”, then “Continue”, then “Yes”. Enter the password you created earlier, and select “Reboot”.

Once the system boots, verify that the NVIDIA module loaded correctly:

lsmod | grep nvidia

When the driver loads successfully, you will see output similar to this:

nvidia_drm             77824  1
nvidia_modeset       1232896  1 nvidia_drm
nvidia              56479744  1 nvidia_modeset
video                  65536  1 nvidia_modeset

nvidia-smi Shows “No devices were found”

When nvidia-smi reports no devices, the kernel module may not have loaded, or there may be a hardware detection issue.

No devices were found

First, check for NVIDIA-related errors in the system journal. These commands use tail to show the most recent entries, so see our tail command guide if you want to adjust the output length:

sudo journalctl -b | grep -i nvidia | tail -20
Jan 08 11:22:14 rocky kernel: NVRM: No NVIDIA GPU found.

Next, verify whether the kernel module loaded:

lsmod | grep -i nvidia || echo "nvidia modules not loaded"
nvidia modules not loaded

If you see nvidia modules not loaded, try loading the module manually:

sudo modprobe nvidia

When modprobe fails, check dmesg for errors:

dmesg | grep -i nvidia | tail -10
[  56.842] NVRM: No NVIDIA GPU found.

After loading the module, rerun nvidia-smi. The standard GPU table output confirms the driver is active:

NVIDIA-SMI 590.xx.xx

MOK Key Lost After Windows Update (Dual Boot)

On dual-boot systems, Windows updates may reset the TPM or firmware settings, which invalidates enrolled MOK keys. When the NVIDIA driver stops loading after a Windows update, you need to re-import the MOK key:

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

Set a password, reboot, and complete the MOK enrollment in the UEFI interface as described above.

Remove NVIDIA Drivers

To remove the NVIDIA drivers and revert to the open-source Nouveau driver, follow the steps below for your Rocky Linux version.

Rocky Linux 8 and 9

First, reset the module stream, then remove the packages:

sudo dnf module reset nvidia-driver -y
sudo dnf remove nvidia-driver* -y
sudo dnf autoremove -y

Rocky Linux 10 (Proprietary DKMS Packages)

Remove the driver packages directly:

sudo dnf remove kmod-nvidia-latest-dkms nvidia-driver nvidia-driver-libs nvidia-driver-cuda -y
sudo dnf autoremove -y

Rocky Linux 10 (Open Kernel Modules)

Remove the open kernel module package and related driver packages:

sudo dnf remove nvidia-open kmod-nvidia-open-dkms nvidia-driver nvidia-driver-libs nvidia-driver-cuda -y
sudo dnf autoremove -y

Re-enable Nouveau (Optional)

If you previously blocked Nouveau and want to restore it, remove the configuration files you created earlier:

sudo rm -f /etc/modprobe.d/blacklist-nouveau.conf
sudo rm -f /etc/dracut.conf.d/blacklist-nouveau.conf
sudo dracut --regenerate-all --force

Remove the NVIDIA Repository (Optional)

To fully clean up, remove the NVIDIA CUDA repository from your system:

sudo rm -f /etc/yum.repos.d/cuda-rhel*.repo
sudo dnf clean all

Finally, reboot to complete the removal and load the Nouveau driver:

sudo reboot

Install the CUDA Toolkit (Optional)

If you plan to develop CUDA applications, install the full CUDA toolkit from the NVIDIA repository:

sudo dnf install cuda -y

Verify the CUDA compiler is available:

nvcc --version
Cuda compilation tools, release 13.1, V13.1.0

CUDA toolkit versions update frequently. Your nvcc output will reflect the current toolkit version from the NVIDIA repository.

Conclusion

You now have NVIDIA drivers installed on Rocky Linux, with DKMS handling kernel module rebuilds across Rocky 8, 9, and 10. The nvidia-smi utility confirms GPU detection and provides real-time monitoring of temperature, memory usage, and running processes. Use the NVIDIA Settings GUI for display tuning, and keep your drivers updated through standard DNF upgrades.

Leave a Comment

Let us know you are human: