You ask — we answer!

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 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.2.2/local_installers/cuda-repo-ubuntu2204-12-2-local_12.2.2-535.104.05-1_amd64.deb

Install downloaded repository

Proceed with installing the package using the standard dpkg utility:

sudo dpkg -i cuda-repo-ubuntu2204-12-2-local_12.2.2-535.104.05-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-2-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 install cuda


Published: 02.05.2024


Still have questions? Write to us!

By clicking «I Accept» you confirm that you have read and accepted the website Terms and Conditions, Privacy Policy, and Moneyback Policy.