Linux Ubuntu OS install Nvidia CUDA Guide

Linux Ubuntu OS install Nvidia CUDA Guide

HanFangchong |

 

1. Check Compatibility Between NVIDIA Driver and CUDA Versions

First, consult the NVIDIA CUDA Toolkit Release Notes to verify the CUDA version compatible with your graphics driver. Official documentation link:

The following diagram shows version compatibility:

CUDA version compatibility chart

Check your driver version using:

nvidia-smi

This displays your driver version. Cross-reference it with the compatibility table or note the maximum supported CUDA version shown (e.g., CUDA Version 12.8).

nvidia-smi output example


2. Download Official CUDA Driver

Official website: https://developer.nvidia.com/cuda-toolkit-archive

For this example, we install CUDA 12.8. You may choose any version up to the maximum supported by your driver (shown in nvidia-smi output).

Select the appropriate installer for your system:

CUDA installer selection

The download commands will be generated after selection:

CUDA download commands

Execute the commands sequentially for installation:

Installation process screenshot


3. Configure Environment Variables

Open the .bashrc file and append these lines (modify cuda-12.8 to match your installed version):

# Modify 'cuda-12.8' based on your installed version. Verify the path if needed.
export PATH=/usr/local/cuda-12.8/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-12.8/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

bashrc configuration example

Apply the changes:

source ~/.bashrc

Verify installation with:

nvcc -V

Successful installation will display:

nvcc verification output

Leave a comment

Please note: comments must be approved before they are published.