Install CUDA® toolkit in Linux
Download CUDA® repository
To ensure a stable Ubuntu release and enable the use of packages from the latest releases, NVIDIA® recommends to set the repository before starting the installation process. Let’s download the specific pin file:
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-ubuntu2204.pin
The following command places the downloaded file into the system directory, which is controlled by the apt package manager:
sudo mv cuda-ubuntu2204.pin /etc/apt/preferences.d/cuda-repository-pin-600
Next step is to download the main CUDA® repository:
wget https://developer.download.nvidia.com/compute/cuda/12.4.0/local_installers/cuda-repo-ubuntu2204-12-4-local_12.4.0-550.54.14-1_amd64.deb
Install downloaded repository
Proceed with installing the package using the standard dpkg utility:
sudo dpkg -i cuda-repo-ubuntu2204-12-4-local_12.4.0-550.54.14-1_amd64.deb
Copy GPG keyring to system directory. This will make it available for use by operating system utilities, including the apt package manager:
sudo cp /var/cuda-repo-ubuntu2204-12-4-local/cuda-*-keyring.gpg /usr/share/keyrings/
Install CUDA® toolkit
Update system cache repositories:
sudo apt update
Finally, install CUDA® toolkit using apt:
sudo apt-get -y install cuda-toolkit-12-4
Updated: 12.08.2025
Published: 10.03.2025