Debian

How to Install NVIDIA CUDA and cuDNN on Debian 12 Bookworm

CUDA is a parallel computing platform and programming model. It allows the software to use GPUs for general-purpose computing.

cuDNN is CUDA Deep Neural Network. It is a GPU-accelerated library for deep neural networks. cuDNN provides highly tuned functions that arise frequently in deep neural network applications.

CUDA and cuDNN are required for TensorFlow to be able to use NVIDIA GPU for accelerating the AI/ML codes.

In this article, we will show you how to install NVIDIA CUDA and cuDNN on Debian 12 “Bookworm”.

Topic of Contents:

  1. Installing the NVIDIA GPU Drivers on Debian 12
  2. Updating the Debian 12 Package Database Cache
  3. Installing NVIDIA CUDA on Debian 12
  4. Checking If NVIDIA CUDA Is Installed on Debian 12
  5. Installing NVIDIA cuDNN on Debian 12
  6. Conclusion

Installing the NVIDIA GPU Drivers on Debian 12

Before you install NVIDIA CUDA and cuDNN on Debian 12, you must install the NVIDIA GPU drivers on Debian 12. If you need any assistance in installing the NVIDIA GPU drivers on Debian 12, read the article on How to Install NVIDIA GPU Drivers on Debian 12 Bookworm.

Updating the Debian 12 Package Database Cache

To update the Debian 12 package database cache, run the following command:

$ sudo apt update

A screenshot of a computer Description automatically generated

Installing NVIDIA CUDA on Debian 12

To install NVIDIA CUDA on Debian 12 “Bookworm”, run the following command:

$ sudo apt install nvidia-cuda-toolkit

To confirm the installation, press Y and then press <Enter>.

A screenshot of a computer Description automatically generated

NVIDIA CUDA and the required dependency packages are being downloaded. It takes a while to complete.

A screenshot of a computer Description automatically generated

NVIDIA CUDA and the required dependency packages are being installed. It takes a while to complete.

A screenshot of a computer Description automatically generated

At this point, the NVIDIA CUDA should be installed on your Debian 12 machine.

A screenshot of a computer Description automatically generated

Checking If NVIDIA CUDA Is Installed on Debian 12

To check if NVIDIA CUDA is installed on Debian 12, run the following command:

$ nvcc --version

As you can see, CUDA 11.8 is installed on Debian 12 “Bookworm”.

A screenshot of a computer Description automatically generated

Installing NVIDIA cuDNN on Debian 12

To install NVIDIA cuDNN on Debian 12 “Bookworm”, run the following command:

$ sudo apt install nvidia-cudnn

Once you see the following window, press <Enter>.

Select “I Agree” and click on “OK”.

A screenshot of a computer Description automatically generated

NVIDIA cuDNN is being installed on Debian 12. It takes a while to complete.

A screenshot of a computer Description automatically generated

NVIDIA cuDNN libraries are being downloaded from the official website of NVIDIA. It takes a while to complete.

A screenshot of a computer Description automatically generated

At this point, NVIDIA cuDNN should be installed on Debian 12.

A screenshot of a computer Description automatically generated

Conclusion

We showed you how to install NVIDIA CUDA on Debian 12 “Bookworm”. We also showed you how to install NVIDIA cuDNN on Debian 12 “Bookworm”.

About the author

Shahriar Shovon

Freelancer & Linux System Administrator. Also loves Web API development with Node.js and JavaScript. I was born in Bangladesh. I am currently studying Electronics and Communication Engineering at Khulna University of Engineering & Technology (KUET), one of the demanding public engineering universities of Bangladesh.