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:
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).
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:
The download commands will be generated after selection:
Execute the commands sequentially for installation:
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}}
Apply the changes:
source ~/.bashrc
Verify installation with:
nvcc -V
Successful installation will display: