Install Nvidia CUDA in Debian Way

Page content
  • For Debian stable/Stretch

Install NVidia driver in Linux server is always tedious and painful. Fortunatelly, Debian stable/Stretch provids ready-to-use NVidia drivers and CUDA toolkits. This post indicates the proper way to install up-to-date Nvidia driver and CUDA in Debian way.

1. Check repository source:

For Debian stable/Stretch, the content of /etc/apt/sources.list file may looks like:

deb http://ftp.debian.org/debian/ stretch main contrib non-free

2. Remove previous installed NVidia drivers if necessary

# apt-get remove --purge nvidia*

3. Install new NVidia drivers

# apt-get install nvidia-driver
  • The current nvidia-driver version is 384.130.

And CUDA

# apt-get install nvidia-cuda-toolkit
  • The current nvidia-cuda-toolkit version is 8.0.44.

4. How about the up-to-date NVidia driver and CUDA toolkit?

One possibility is to use Debian testing/Buster, or unstable/Sid distrubutions. If we’d like to stick to stable/Stretch, the alternative way is to launch Debian stable backports.

At first, append this line to /etc/apt/sources.list file:

deb http://ftp.debian.org/debian stable-backports main contrib non-free

Then, run

# apt-get update

Now we can install recent packages from backports distribution:

# apt-get -t stable-backports install nvidia-driver nvidia-cuda-toolkit

The current (2018-11-12) version of NVidia driver and CUDA toolkit in Debian stable backports are 390.87 and 9.1.85, respectively.