> ## Documentation Index
> Fetch the complete documentation index at: https://help.onetsolutions.net/llms.txt
> Use this file to discover all available pages before exploring further.

# Install the NVIDIA drivers

> Install the NVIDIA drivers on your VPS to use the GPU you attached to it

Once the GPU is attached to your VPS, the system needs the NVIDIA drivers to use it. This page gives the commands to run for your operating system.

> [!NOTE]
>
> **Prerequisites**
>
> * A High Performance VPS with a GPU attached from your instance's **GPU** tab, in the console
> * Root SSH access to your server ([How to connect](https://help.onetsolutions.net/tutorials/how-to-connect-to-linux-server.md))

## Check that the GPU is visible

The GPU shows up in the system from the restart that follows the attachment, even before the drivers are installed:

```bash theme={null}
lspci | grep -i nvidia
```

The command prints an `NVIDIA Corporation` line. If it prints nothing, restart the VPS from the console and run it again.

## Install the drivers

Update the system first: the drivers are built for the newest kernel, the one the VPS restarts on.

> [tab] Debian 12 / 13
>
> The drivers come from NVIDIA's CUDA repository. Branch 595 is NVIDIA's production branch; pinning it keeps `apt` from moving to another branch on its own:
>
> ```bash theme={null}
> apt update && apt full-upgrade -y
> apt install -y linux-headers-amd64 wget
> wget https://developer.download.nvidia.com/compute/cuda/repos/debian$(. /etc/os-release; echo $VERSION_ID)/x86_64/cuda-keyring_1.1-1_all.deb
> dpkg -i cuda-keyring_1.1-1_all.deb
> apt update
> apt install -y nvidia-driver-pinning-595
> apt install -y --no-install-recommends nvidia-kernel-open-dkms nvidia-driver-cuda nvidia-persistenced
> reboot
> ```

> [tab] Ubuntu 22.04 / 24.04 / 26.04
>
> Ubuntu ships the NVIDIA modules prebuilt for its kernel. The `580-server` branch is NVIDIA's long-term branch for data center GPUs:
>
> ```bash theme={null}
> apt update && apt full-upgrade -y
> apt install -y linux-modules-nvidia-580-server-open-generic nvidia-headless-no-dkms-580-server-open nvidia-utils-580-server
> reboot
> ```

> [tab] Rocky Linux / AlmaLinux 9 and 10
>
> The drivers come from NVIDIA's CUDA repository, and DKMS from EPEL:
>
> ```bash theme={null}
> dnf install -y epel-release dnf-plugins-core
> dnf config-manager --set-enabled crb
> dnf update -y
> dnf install -y kernel-devel-matched kernel-headers
> dnf config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel$(rpm -E %rhel)/x86_64/cuda-rhel$(rpm -E %rhel).repo
> dnf install -y nvidia-open
> reboot
> ```

> [!NOTE]
>
> The restart takes your VPS offline for a few moments. See [Restart](https://help.onetsolutions.net/vps/restart.md) for details.

## Check the installation

After the restart, `nvidia-smi` shows the GPU, the driver version, the memory in use and the temperature:

```bash theme={null}
nvidia-smi
```

To keep the driver loaded between jobs, which makes them start faster, turn on persistence mode:

```bash theme={null}
systemctl enable --now nvidia-persistenced
```

## Install CUDA (optional)

PyTorch, TensorFlow, Ollama and vLLM bundle the CUDA libraries they need: the driver is enough. To compile your own CUDA code with `nvcc`, install the CUDA Toolkit:

> [tab] Debian
>
> ```bash theme={null}
> apt install -y cuda-toolkit
> /usr/local/cuda/bin/nvcc --version
> ```

> [tab] Ubuntu
>
> ```bash theme={null}
> apt install -y nvidia-cuda-toolkit
> nvcc --version
> ```

> [tab] Rocky Linux / AlmaLinux
>
> ```bash theme={null}
> dnf install -y cuda-toolkit
> /usr/local/cuda/bin/nvcc --version
> ```

> [!TIP]
>
> After a kernel update, restart the VPS: on Debian, Rocky Linux and AlmaLinux, DKMS rebuilds the NVIDIA module for the new kernel, and on Ubuntu the prebuilt modules follow the kernel.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.