How to Install NVIDIA CUDA Toolkit on Ubuntu 24.04 Dedicated GPU Server

Learn how to install the NVIDIA CUDA Toolkit on an Ubuntu 24.04 LTS dedicated GPU server. A complete, step-by-step guide with troubleshooting and best practices for AI and deep learning workloads.

Setting up a dedicated GPU server for artificial intelligence, deep learning, or high-performance computing (HPC) requires a rock-solid software foundation. If you are running Ubuntu 24.04 LTS (Noble Numbat) on a dedicated server from Leo Servers, installing the NVIDIA CUDA Toolkit is the most critical step to unlocking your hardware’s true computational power.

CUDA (Compute Unified Device Architecture) is a parallel computing platform and programming model created by NVIDIA. It allows developers to speed up compute-intensive applications by harnessing the power of GPUs for the parallelizable part of the computation.

In this comprehensive, step-by-step tutorial, we will walk through the exact process of installing the NVIDIA CUDA Toolkit on an Ubuntu 24.04 dedicated GPU server using the official NVIDIA network repository. We will also cover pre-installation checks, environment configuration, and essential troubleshooting to ensure your server is production-ready.

What You'll Learn

Why Use the Network Repository Method?

NVIDIA offers multiple ways to install the CUDA toolkit, including local runfiles and deb packages. However, as server administrators and infrastructure experts, we highly recommend the Network Repository (apt) method.

  • Seamless Updates: It integrates directly with Ubuntu's Advanced Package Tool (apt), making future driver and toolkit updates as simple as running sudo apt upgrade.
  • Dependency Management: The package manager automatically resolves and installs necessary dependencies, significantly reducing the risk of broken packages or kernel panics.

Phase 1: Pre-Installation Checks and Server Preparation

Before downloading any packages, we must ensure your dedicated server is running compatible hardware and a clean software environment. Skipping this phase is the leading cause of installation failures.

1
Verify Your GPU is CUDA-Capable

First, confirm that your system recognizes your NVIDIA GPU. Connect to your server via SSH and run the following command:

BASH
lspci | grep -i nvidia

Expected Output: You should see a list of your installed NVIDIA graphics cards (e.g., NVIDIA Corporation AD102GL [RTX 6000 Ada Generation]). If this returns nothing, check your server's PCIe connections or contact your hosting provider's hardware support.

2
Verify Your Operating System

Ensure you are running Ubuntu 24.04 LTS.

BASH
cat /etc/os-release

Expected Output: Look for PRETTY_NAME="Ubuntu 24.04 LTS".

3
Verify GCC Installation

The CUDA Toolkit requires a C compiler to compile host code. Ubuntu 24.04 usually comes with GCC pre-installed, but you should verify:

BASH
gcc --version

If it is not installed, install the essential build packages:

BASH
sudo apt update
sudo apt install build-essential -y

4
Verify the System has the Correct Kernel Headers

CUDA requires the kernel headers and development packages for the currently running kernel to build the NVIDIA driver modules securely.

BASH
sudo apt-get install linux-headers-$(uname -r)

5
Remove Outdated NVIDIA Drivers (If Applicable)

If your dedicated server was previously configured with open-source drivers (Nouveau) or older, conflicting NVIDIA drivers, you must purge them to prevent module conflicts.

BASH
sudo apt-get --purge remove "*nvidia*"
sudo apt-get autoremove
sudo apt-get autoclean

Phase 2: Installing the NVIDIA CUDA Toolkit

With the system prepped, we can proceed to the actual installation. We will add the official NVIDIA package repositories to your Ubuntu 24.04 server.

1
Download the NVIDIA CUDA Keyring

To ensure the authenticity of the packages you download, NVIDIA signs them with a GPG key. You need to install this keyring into your server's trusted repositories. Run the following commands sequentially:

BASH
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64/cuda-keyring_1.1-1_all.deb
sudo dpkg -i cuda-keyring_1.1-1_all.deb

2
Update the Apt Repository Cache

Now that your server trusts the NVIDIA repository, update your apt cache so it can see the newly available CUDA packages.

BASH
sudo apt-get update

3
Install the CUDA Toolkit

You have a choice here. You can install the generic cuda package (which installs the latest toolkit and the latest proprietary NVIDIA drivers) or a specific toolkit version (e.g., cuda-toolkit-12-4) if your specific machine learning framework (like PyTorch or TensorFlow) requires a strict version.

For the vast majority of deep learning and HPC workloads on a fresh server, installing the latest unified package is the best approach:

BASH
sudo apt-get -y install cuda-toolkit-12-x
# Note: Replace '12-x' with the exact latest version block you need, 
# or simply run the following to get the default bundled version:
sudo apt-get -y install cuda

(Depending on your server’s internet speed and disk I/O, this process may take 5 to 15 minutes. The installation handles the proprietary NVIDIA driver, the CUDA libraries, and the compiler).

4
Install the NVIDIA Driver (If not bundled)

If you opted to install only the toolkit using cuda-toolkit-12-x instead of the metapackage cuda, you must install the proprietary driver separately:

BASH
sudo apt-get -y install nvidia-driver-550

(Note: Driver versions iterate quickly. Use ubuntu-drivers devices to see the recommended driver version for your specific GPU architecture).

5
Reboot Your Server

Kernel-level modules have been installed. To ensure the NVIDIA driver is loaded properly into the Linux kernel and the open-source Nouveau driver is fully disabled, a reboot is mandatory.

BASH
sudo reboot

Phase 3: Post-Installation Configuration

A common mistake made by beginners is assuming the installation is complete after the reboot. However, Ubuntu does not automatically add the CUDA compiler (nvcc) to your system's executable path.

If you try to check your CUDA version right now, the terminal will likely throw a "command not found" error. You must configure your environment variables.

1
Update the bashrc File

You need to append the CUDA binary path to your system's $PATH variable and the library path to $LD_LIBRARY_PATH. Open your bash profile:

BASH
nano ~/.bashrc

Scroll to the very bottom of the file and paste the following lines:

BASH
# NVIDIA CUDA Toolkit Environment Variables
export PATH=/usr/local/cuda/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

Save the file (CTRL + O, Enter, CTRL + X).

2
Source the Profile

To apply these changes immediately without logging out and back into your SSH session, run:

BASH
source ~/.bashrc

Phase 4: Verifying the Installation

To guarantee your dedicated GPU server is ready for heavy workloads, we need to run two distinct verification tests.

1
Verify the NVIDIA Driver

First, let's check if the proprietary driver is communicating with the hardware. Run the System Management Interface command:

BASH
nvidia-smi

What to look for in the output:

  • Your specific GPU model should be listed.
  • The Driver Version should be visible (e.g., 550.xx).
  • The CUDA Version supported by this driver should be shown in the top right corner.

2
Verify the CUDA Compiler (NVCC)

Next, ensure that the actual CUDA Toolkit (the development tools used to compile AI software) is properly installed and accessible.

BASH
nvcc --version

What to look for in the output:

  • You should see a copyright notice from NVIDIA and the specific release version of the CUDA compiler (e.g., Cuda compilation tools, release 12.4, V12.4.xx).

If both commands return the correct data, congratulations! Your Ubuntu 24.04 dedicated server is fully equipped with the NVIDIA CUDA Toolkit.

Troubleshooting Common Errors

Even with a flawless execution, server environments can have unique quirks. Here are solutions to the most common issues administrators face on Ubuntu 24.04.

Error 1: "nvcc: command not found" after installation
The Cause: Your server successfully installed the software, but the system doesn't know where to look for the executable.
The Fix: You missed Phase 3 of this tutorial. You must add /usr/local/cuda/bin to your system's $PATH variable in your ~/.bashrc file and source it.
Error 2: nvidia-smi returns "NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver."
The Cause: There is a mismatch between the installed driver and the loaded Linux kernel, or you forgot to reboot your server after the installation.
The Fix:
  • 1. Reboot the server.
  • 2. If it still fails, ensure Secure Boot is disabled in your server's BIOS (or via your hosting provider's IPMI dashboard). Secure Boot blocks unsigned proprietary drivers from loading into the Linux kernel.
  • 3. Verify that the open-source driver is disabled by running lsmod | grep nouveau. If it returns output, you need to blacklist nouveau manually.
Error 3: Broken Packages (Unmet Dependencies)
The Cause: You might have remnants of older repository lists or a corrupted apt cache.
The Fix: Run the following cleanup sequence:
BASH
sudo apt --fix-broken install
sudo apt-get autoremove
sudo apt-get update
Then, retry the installation steps.

Scale Your AI with Leo Servers

Deploying the NVIDIA CUDA Toolkit on an Ubuntu 24.04 dedicated server doesn't have to be a headache. By leveraging the official apt network repositories, properly staging your system dependencies, and configuring your environment variables, you create a stable, update-friendly foundation for your most intensive applications.

Whether you are rendering complex 3D graphics, running large language models (LLMs), or processing massive datasets, your Leo Servers dedicated GPU instance is now fully primed for peak performance.

Are you looking for high-performance, unmetered dedicated GPU servers? Explore our bare-metal infrastructure today.

Explore GPU Servers →

Discover Leo Servers High-Performance Locations

Leo Servers operates premium bare-metal environments worldwide, offering diverse hosting options. Check out our specialized offerings to choose the setup that best suits your intensive workload needs.