RHEL BasedRocky Linux

How To Install NVIDIA Drivers on Rocky Linux 9

Install NVIDIA Drivers on Rocky Linux 9

In this tutorial, we will show you how to install Nvidia Drivers on Rocky Linux 9. Installing NVIDIA drivers on Rocky Linux 9 is essential for users who want to leverage the full potential of their NVIDIA graphics cards. Proper driver installation enhances system performance, enables advanced graphical features, and supports GPU-accelerated applications. This guide will walk you through the entire process, ensuring a smooth installation experience.

Understanding NVIDIA Drivers

What are NVIDIA Drivers?

NVIDIA drivers are software components that allow your operating system to communicate effectively with NVIDIA graphics hardware. These drivers act as a bridge between the operating system and the GPU, facilitating optimal performance and functionality.

Why Install NVIDIA Drivers on Rocky Linux?

While Rocky Linux comes with open-source drivers, installing proprietary NVIDIA drivers offers several advantages:

  • Performance: Proprietary drivers often provide better performance in graphics-intensive applications and games.
  • Support for CUDA: If you are using applications that require CUDA for parallel computing, the proprietary drivers are necessary.
  • Enhanced Features: Proprietary drivers support advanced features such as NVIDIA G-SYNC and improved power management.

Pre-installation Requirements

System Requirements

Before installing NVIDIA drivers, ensure that your system meets the following hardware requirements:

  • An NVIDIA GPU compatible with the latest drivers.
  • A minimum of 4 GB RAM (more is recommended for optimal performance).
  • Sufficient disk space for driver installation and updates.

Software Prerequisites

Ensure your Rocky Linux system is up-to-date. Open a terminal and run the following commands:

sudo dnf update -y

You will also need to install several development packages. Execute this command to install them:

sudo dnf install gcc make kernel-devel kernel-headers -y

Disabling Secure Boot

If your system has Secure Boot enabled, it may prevent the installation of third-party drivers. To disable Secure Boot, follow these steps:

  • Reboot your computer and enter the BIOS/UEFI settings (usually by pressing F2, F10, or DEL during startup).
  • Navigate to the “Boot” or “Security” tab.
  • Find the Secure Boot option and set it to “Disabled.”
  • Save changes and exit BIOS/UEFI.

Enabling EPEL Repository

What is EPEL?

The Extra Packages for Enterprise Linux (EPEL) repository provides additional packages that are not included in the standard Rocky Linux repositories. Enabling EPEL can help in obtaining dependencies required for certain software installations.

How to Enable EPEL

To enable the EPEL repository, run the following command in your terminal:

sudo dnf install epel-release -y

Adding the NVIDIA Repository

Why Add the NVIDIA Repository?

The official NVIDIA repository contains the latest drivers optimized for your hardware. By adding this repository, you ensure that you receive updates directly from NVIDIA.

Steps to Add the Repository

Add the NVIDIA repository by executing this command:

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

Installing NVIDIA Drivers

Installing Kernel Development Packages

The kernel development packages are necessary for building kernel modules required by the NVIDIA driver. Install them using this command:

sudo dnf install kernel-devel-$(uname -r) kernel-headers-$(uname -r) -y

Installing the NVIDIA Driver

You can now proceed with installing the NVIDIA driver. Use this command to install both the driver and settings utility:

sudo dnf install nvidia-driver nvidia-settings -y

Optional: Installing CUDA Toolkit

If you plan to use CUDA for development or other applications, you can install it alongside the driver using this command:

sudo dnf install cuda -y

Blacklisting Nouveau Driver

What is Nouveau?

Nouveau is an open-source driver for NVIDIA graphics cards. While it provides basic functionality, it can conflict with proprietary drivers. Blacklisting Nouveau ensures that it does not load during boot.

How to Blacklist Nouveau

Create a blacklist configuration file by executing these commands:

echo "blacklist nouveau" | sudo tee /etc/modprobe.d/blacklist-nouveau.conf
echo "options nouveau modeset=0" | sudo tee -a /etc/modprobe.d/blacklist-nouveau.conf
sudo dracut --force

Verifying Installation

Rebooting the System

A reboot is necessary for all changes to take effect. Run this command to restart your system:

sudo reboot

Testing Driver Installation

nvidia-smi

This command should display information about your GPU, including its utilization and memory usage. If you see this information, congratulations! The installation was successful.

Troubleshooting Common Issues

Common Installation Errors

If you encounter issues during installation, consider these common problems:

  • Error: No screens found: This may indicate that Nouveau is still loaded. Ensure you have blacklisted Nouveau correctly and rebooted.
  • Error: Unable to find a suitable display device: This could be due to incorrect driver installation or a misconfigured Xorg file. Check your configuration settings in `/etc/X11/xorg.conf`.
  • Error: Driver not loaded: If `nvidia-smi` returns an error indicating that the driver isn’t loaded, check if Secure Boot is disabled and if all necessary packages were installed correctly.

Checking Logs for Errors

If problems persist, check system logs for more detailed error messages. Use these commands to view logs related to Xorg and kernel messages:

dmesg | grep nvidia
cat /var/log/Xorg.0.log | grep EE
cat /var/log/messages | grep nvidia

These logs can provide insights into what went wrong during installation or configuration.

Congratulations! You have successfully installed Nvidia Drivers. Thanks for using this tutorial for installing Nvidia Drivers on your Rocky Linux 9 system. For additional help or useful information, we recommend you check the official Nvidia website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button