The commands and advice below come from Canonical's Ubuntu Server documentation, NVIDIA's Driver Installation Guide and CUDA Installation Guide for Linux, and Ollama's Linux documentation, all read on 24 November 2026. Package names and driver versions change regularly, so use the versions your own system lists rather than copying the example numbers.
Plenty of people who run local AI end up on Linux. It might be a spare PC turned into an always-on AI server, a dual-boot setup alongside Windows 11, or simply because many AI tools are developed on Linux first. Whatever the reason, the first job on an NVIDIA system is getting the graphics driver installed properly. If the driver is missing or broken, apps such as Ollama, llama.cpp and ComfyUI can't use your graphics card.
Ubuntu makes this easier than it used to be. This guide covers the method Canonical recommends, when to pick a server driver, how to check it worked, and how to fix the errors you're most likely to see.
Before you start
A supported NVIDIA graphics card fitted and connected. AI apps have their own minimum requirements too. Ollama's documentation, for example, supports NVIDIA cards with compute capability 5.0 or newer and driver version 550 or newer, and cards with compute capability 5.0 to 6.2 need driver 570 or newer.
Ubuntu installed and connected to the internet. NVIDIA's Driver Installation Guide covers Ubuntu 22.04, 24.04 and 26.04.
Administrator (sudo) access.
Know whether you use Secure Boot. Canonical says most modern x86 systems do, and it affects which driver packages you should use.
Step 1: Check whether a driver is already running
Open a terminal and run:
cat /proc/driver/nvidia/version
If this prints a driver version, an NVIDIA driver is already loaded. If the file doesn't exist, no NVIDIA driver is running yet.
Step 2: Update Ubuntu and reboot
Canonical recommends making sure your system and kernel are up to date first:
sudo apt update && sudo apt upgrade
When it finishes, reboot, so you're running the latest kernel before the driver's kernel modules are installed.
Step 3: See which drivers Ubuntu offers
The ubuntu-drivers tool is Canonical's recommended method. It uses the same logic as the Additional Drivers tool in Ubuntu's desktop settings. To list the drivers available for your hardware, run:
sudo ubuntu-drivers list
On a headless server or a machine used mainly for computing, list the server drivers instead:
sudo ubuntu-drivers list --gpgpu
Canonical packages two kinds of NVIDIA driver:
Driver type | Package names | Canonical's recommendation |
|---|
Unified Driver Architecture (UDA) | e.g. nvidia-driver-550, nvidia-driver-550-open | Generic desktop use, including gaming |
Enterprise Ready Drivers (ERD) | Names ending in -server, e.g. nvidia-driver-550-server | Servers and computing tasks |
Which should you choose for local AI? If the PC is also your everyday desktop with a monitor attached, use the normal desktop driver. If it's a dedicated AI box you'll mainly reach over the network, the server drivers are the ones Canonical recommends for computing tasks.
Step 4: Install the driver
For a desktop PC, the simplest option is to let Ubuntu pick the best match for your hardware:
sudo ubuntu-drivers install
To install a specific version from the list, add its number. For example, for the 535 driver:
sudo ubuntu-drivers install nvidia:535
For a server or compute machine, use the --gpgpu option:
sudo ubuntu-drivers install --gpgpu
or choose a specific server driver, then add the matching utilities package, which Canonical lists as an extra component for server installs:
sudo ubuntu-drivers install --gpgpu nvidia:535-server
sudo apt install nvidia-utils-535-server
Canonical says ubuntu-drivers is the best choice on Secure Boot systems because, by default, it only installs pre-built, signed drivers that are known to work with Secure Boot. It will also remove a conflicting NVIDIA driver before installing the new one.
Step 5: Reboot and check with nvidia-smi
Reboot, then run:
nvidia-smi
Ollama's Linux documentation uses this same command to confirm the driver is installed: it should print details about your GPU. If you see your card listed with its memory, the driver is working. Our guide to logging GPU usage with nvidia-smi shows how to keep an eye on your card while models run.
Not necessarily. Ollama's Linux guide lists installing CUDA as an optional step. NVIDIA's CUDA Installation Guide for Linux also points out that, starting with CUDA 13.4, the CUDA Toolkit and the NVIDIA driver are installed separately, and none of the toolkit metapackages install the driver. So if a tool you use does ask for the CUDA Toolkit, you still need the driver installed first, using the steps above.
The alternative: NVIDIA's own repository
NVIDIA's Driver Installation Guide describes installing drivers from NVIDIA's own package repository instead. After adding the repository, it installs the open kernel module driver with:
sudo apt install nvidia-open
NVIDIA also documents a compute-only install, which leaves out desktop components such as OpenGL, Vulkan and X drivers. That can suit a headless AI server:
sudo apt -V install libnvidia-compute nvidia-dkms-open
Pick one source and stick with it. Canonical warns that NVIDIA drivers installed from sources outside those in its guide could overwrite the ones provided by ubuntu-drivers and may break Secure Boot. NVIDIA also notes that from its 590 driver branch onwards, its Ubuntu package names no longer include the branch number, with pinning packages used to stay on a particular branch.
Troubleshooting
Problem | Likely cause (per Canonical's docs) | Fix |
|---|
nvidia-smi says "Failed to initialize NVML: Driver/library version mismatch"
| The driver's user-space packages were updated but the old kernel module is still loaded, often after a system upgrade | Reboot. You can confirm with sudo dmesg, which shows an "API mismatch" message |
nvidia-smi says "No devices were found"
| The open-source nouveau driver is loaded and conflicts with NVIDIA's driver | Check whether nouveau is loaded, then blocklist it, rebuild the initramfs and reboot (commands below) |
You need a custom kernel | Pre-built driver modules may not support it | Use the DKMS packages, but note they aren't signed with Canonical's key, so you'll need to enrol your own key for Secure Boot |
To check whether nouveau is loaded, run lsmod | grep nouveau. Canonical's commands to blocklist it are:
echo "blacklist nouveau" | sudo tee /etc/modprobe.d/disable-nouveau.conf
echo "options nouveau modeset=0" | sudo tee -a /etc/modprobe.d/disable-nouveau.conf
sudo rmmod nouveau || true
sudo update-initramfs -u
Then reboot.
To remove the NVIDIA driver completely, Canonical's guide uses sudo apt --purge remove with the driver branch you installed, followed by sudo apt autoremove.
Next steps for local AI
With nvidia-smi working, you're ready to install your AI apps. Our guide to installing Ollama on Linux is a good place to start, and you can then check that Ollama is using your GPU rather than the CPU. If the PC will run all day, it's worth looking at setting a GPU power limit with nvidia-smi too.
Our verdict
The easiest and safest way to install NVIDIA drivers on Ubuntu for local AI is Canonical's ubuntu-drivers tool: update and reboot, list the drivers, run sudo ubuntu-drivers install (or --gpgpu for a headless AI server), reboot again and check with nvidia-smi. It installs signed drivers that work with Secure Boot. Only use NVIDIA's own repository if you specifically need its packages, such as a compute-only install, and don't mix the two sources. Most local AI apps then need nothing more than a working driver to use your GPU.