Guideschevron_rightServers

Servers · 7 min read · Updated

How to Install NVIDIA Drivers on Ubuntu Server

To install NVIDIA drivers on Ubuntu Server, update the system and reboot, list the server drivers with sudo ubuntu-drivers list --gpgpu, install one with sudo ubuntu-drivers install --gpgpu plus the matching nvidia-utils package, reboot again and check the card with nvidia-smi. For GPUs inside Docker containers, add the NVIDIA Container Toolkit and run nvidia-ctk runtime configure. You rarely need the full CUDA toolkit.

1. Check the GPU and Update

lspci | grep -i nvidia          # the card should be listed
sudo apt update && sudo apt upgrade
sudo reboot

Rebooting after the upgrade means the driver is built for the kernel you will actually run. This guide uses Ubuntu 24.04; the same steps work on 22.04.

2. Install the Driver

sudo ubuntu-drivers list --gpgpu
# e.g. nvidia-driver-570-server, nvidia-driver-570-server-open

sudo ubuntu-drivers install --gpgpu          # the recommended one
# or a specific branch from the list:
# sudo ubuntu-drivers install --gpgpu nvidia:570-server

sudo apt install -y nvidia-utils-570-server   # nvidia-smi, same branch number
sudo reboot

Replace 570 with the branch the list shows for your card. The -open variants use NVIDIA's open kernel modules, which NVIDIA recommends for recent GPUs.

3. Check It Works

nvidia-smi
cat /proc/driver/nvidia/version

nvidia-smi lists every GPU with its memory, temperature, power and the processes using it, and shows the newest CUDA version the driver supports. watch -n 1 nvidia-smi keeps it updating while a job runs.

4. GPUs in Docker Containers

With Docker installed, add NVIDIA's repository and the Container Toolkit, then let Docker use it:

curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \
  && curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \
    sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
    sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list

sudo apt-get update
sudo apt-get install -y nvidia-container-toolkit
sudo nvidia-ctk runtime configure --runtime=docker   # edits /etc/docker/daemon.json
sudo systemctl restart docker

sudo docker run --rm --runtime=nvidia --gpus all ubuntu nvidia-smi

The last command should print the same table as on the host. In Compose files, give a service the GPUs with a deploy.resources.reservations.devices entry for the nvidia driver.

When Something Is Wrong

Common NVIDIA driver errors on Ubuntu and their fixes
MessageUsual causeFix
Driver/library version mismatchAn update replaced the driver while the old module is loadedReboot
NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driverThe module is not loaded, often right after installReboot; then check sudo dmesg | grep -i nvidia
No devices were foundThe driver does not support the card, or the card is not seenCheck lspci, try the newest -server branch, reboot
nouveau in lsmod | grep nouveauThe open-source driver grabbed the cardInstall through ubuntu-drivers, which blacklists it, and reboot

Next: how much GPU memory a model needs, and serving an LLM API with vLLM or Ollama.

Common Questions

  • Do I need the CUDA toolkit as well as the driver?

    Usually not. The driver is what runs CUDA programs; PyTorch, Ollama, vLLM and most Docker images bring their own CUDA libraries. Install the CUDA toolkit only to compile CUDA code yourself, and pick a toolkit version your driver supports.

  • What is the difference between the -server and the regular drivers?

    Ubuntu packages NVIDIA's data-center driver branches with a -server suffix for compute work on servers without a desktop. ubuntu-drivers list --gpgpu shows them, and they are the ones to use on a headless GPU server.

  • Which CUDA version does my driver support?

    nvidia-smi prints it in the top right corner as CUDA Version: that is the newest CUDA the driver can run, not a toolkit that is installed. Software built for a newer CUDA needs a newer driver.

  • Why did nvidia-smi stop working after updates?

    Most often an update installed a new driver library while the old kernel module is still loaded, which shows as "Driver/library version mismatch". Rebooting loads the matching module.

Plans and prices

Dedicated Servers

Bare-metal servers with full root access, billed monthly.

See all plans
  • AMD Ryzen 9 5950X

    16 Cores · 128 GB RAM · 2x 1TB NVMe

    Ashburn, VA · Dallas, TX · 50 TB transfer · 10 GigE

    $399.00/mo

  • AMD Ryzen 9 9950X

    16 Cores · 192 GB RAM · 2x 2 TB NVMe

    Ashburn, VA · Dallas, TX · 50 TB transfer · 10 GigE

    $669.00/mo

  • AMD EPYC 4585PX

    16 Cores · 128 GB RAM · 2x 6.4TB NVMe Gen4

    Dallas, TX · 200 TB transfer · 50 Gbps

    $849.00/mo

  • AMD EPYC 7443P

    24 Cores · 512 GB RAM · 2x 2TB NVMe

    Dallas, TX · Ashburn, VA · 50 TB transfer · 10 GigE

    $969.00/mo

Keep Reading

All guides