Skip to content

Commit

Permalink
added article on installing NVIDIA GPU drivers (#2299)
Browse files Browse the repository at this point in the history
  • Loading branch information
j0eybrinkman authored Aug 27, 2024
1 parent 2274c50 commit 8427e6a
Showing 1 changed file with 121 additions and 0 deletions.
121 changes: 121 additions & 0 deletions docs/desktop/display/installing_nvidia_gpu_drivers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
---
title: Installing NVIDIA GPU Drivers
author: Joseph Brinkman
contributors:
---

## Introduction

Nvidia is one of the most popular GPU manufacturers. There is more than one way to install Nvidia GPU drivers. This guide uses Nvidia's official repository to install their drivers. Therefore much of this guide is referenced from [Nvidia's installation guide](https://docs.nvidia.com/cuda/pdf/CUDA_Installation_Guide_Linux.pdf).

!!! Note

The pre-installation actions link is broken in Nvidia's official guide. You will need to install necessary utilities and dependencies to install the Nvidia driver from their official repository.

Some other alternative ways to install Nvidia drivers include:

- Nvidia's `.run` installer
- Third-party RPMFusion repository
- Third-party ELRepo driver

In most cases, it's best to install Nvidia drivers from the official source. RPMFusion and ELRepo are available for those who prefer a community-based repository. RPMFusion is considered to work best for older hardware. It is advisable to avoid using the `.run` installer. While convienent, using the `.run` installer is notorious for overwriting system files as well as incompatibility issues.

## Assumptions

For this guide, you need the following:

* Rocky Linux Workstation
* `sudo` privileges

## Install necessary utilities and dependencies

Enable the Extra Packages for Enterprise Linux (EPEL) repository:

```bash
sudo dnf install epel-release -y
```

Installing development tools ensures necessary build dependencies are met.

Install the `Development Tools`:

```bash
sudo dnf groupinstall "Development Tools" -y
```

The `kernel-devel` package provides necessary headers and tools to build kernel modules.

Install it with the command below:

```bash
sudo dnf install kernel-devel -y
```

Dynamic Kernel Module Support (DKMS) is a program used to automatically rebuild kernel modules.

Install the `dkms` package:

```bash
sudo dnf install dkms -y
```

## Install NVIDIA Drivers

After installing the necessary prerequisites, it is time to install the Nvidia drivers.

Add the official Nvidia repository with the following command:

!!! Note

If you are using Rocky 8, replace `rhel9` in the file path with `rhel8`.

```bash
sudo dnf config-manager --add-repo http://developer.download.nvidia/compute/cuda/repos/rhel9/$(uname -i)/cuda-rhel9.repo
```

Next, install a set of packages necessary for building and installing kernel modules:

```bash
sudo dnf install kernel-headers-$(uname -r) kernel-devel-$(uname -r) tar bzip2 make automake gcc gcc-c++ pciutils elfutils-libelf-devel libglvnd-opengl libglvnd-glx libglv-devel acpid pkgconfig dkms -y
```

Install the latest NVIDIA driver module for your system:

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

## Disable nouveau

Nouveau is an open-source NVIDIA driver that provides limited functionality compared to NVIDIA's proprietary drivers. Its best to disable it when using to avoid driver conflicts:

Open the grub configuration file with an editor of your choice:

```bash
sudo vim /etc/default/grub
```

Add `nouveau.modset=0` and `rd.driver.blacklist=nouveau` at the end of `GRUB_CMDLINE_LINUX`.

The value of `GRUB_CMDLINE_LINUX` should look similar to the text below although it will not, nor does it need to be, an exact match:

```bash
GRUB_CMDLINE_LINUX="resume=/dev/mapper/rl-swap rd.lvm.lv=rl/root rd.lvm.lv=rl/swap crashkernel=auto rhgb quiet nouveau.modeset=0 rd.driver.blacklist=nouveau"
```

Reload the grub environment:

```bash
grub2-mkconfig -o /boot/grub2/grubenv
```

Reboot:

```bash
sudo reboot now
```

## Conclusion

Congratulations! You've successfully installed NVIDIA GPU drivers on your system using NVIDIA's official repository. Enjoy the enhanced capabilities of your NVIDIA GPU that the default Nouveau drivers can't provide.

0 comments on commit 8427e6a

Please sign in to comment.