Installing Nvidia GPU Drivers on Linux

This document provides instructions for installing Nvidia GPU drivers

Installation on Red Hat Enterprise Linux (RHEL 9)

Follow these steps to install Nvidia drivers and nvidia-smi on your RHEL 9 instance.

Step 1: Enable EPEL and CodeReady Builder Repositories

First, update the DNF package repository cache and enable necessary repositories.

# Update the DNF package repository cache
sudo dnf makecache

# Enable the RHEL 9 CodeReady Builder package repository.
# This repository provides additional development tools and libraries.
sudo subscription-manager repos --enable codeready-builder-for-rhel-9-$(uname -i)-rpms

# Install the epel-release package. EPEL (Extra Packages for Enterprise Linux)
# provides high-quality add-on packages for RHEL.
sudo dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm

# Update the DNF package repository cache again to ensure all changes take effect.
sudo dnf makecache

Step 2: Install Dependencies and Build Tools

Install the necessary build tools and kernel headers required for compiling Nvidia kernel modules.

Step 3: Add the Nvidia CUDA Repository

Add the official Nvidia CUDA package repository to your system. This repository contains the latest Nvidia drivers and CUDA toolkit.

Step 4: Install Nvidia GPU Drivers

Install the Nvidia GPU drivers from the newly added repository.

Step 5: Verify the Installation

After the installation is complete, reboot your system to ensure the new drivers are loaded correctly.

After rebooting, log back in and verify the driver installation:

result of nvidia-smi command

Installation on Ubuntu

Follow these steps to install Nvidia drivers and nvidia-smi on your Ubuntu instance. The process is generally simpler on Ubuntu.

Step 1: Update Package Lists

Before installing any new packages, ensure your system's package lists are up-to-date.

Step 2: Install Nvidia GPU Drivers

Ubuntu provides a utility to automatically detect and install the recommended Nvidia drivers. This is the simplest method.

Alternatively, if you want to install a specific driver version (e.g., nvidia-driver-535), you can first search for available drivers and then install the desired one:

Step 3: Verify the Installation

After the installation is complete, reboot your system to ensure the new drivers are loaded correctly.

After rebooting, log back in and verify the driver installation:

result of nvidia-smi command

Last updated

Was this helpful?