How to install Cuda 10.2, cuDNN 7.6.5 and samples on ubuntu 18.04

Anar Mammadli
3 min readJul 23, 2021
cuda 10.2 on ubuntu

I need to downgrade Cuda from 11.4 to 10.2, so if you downloaded another version on your system , you can delete these files starting from section 1.

Section 1 — Clean remaining files

Deleting any NVIDIA/CUDA packages you may already have installed

sudo rm /etc/apt/sources.list.d/cuda*
sudo apt remove --autoremove nvidia-cuda-toolkit
sudo apt remove --autoremove nvidia-*

Deleting any remaining Cuda files on /usr/local/

sudo rm -rf /usr/local/cuda*

Purge any remaining NVIDIA configuration files

sudo apt-get purge nvidia*

Purge and remove

sudo apt-get --purge -y remove 'cuda*'
sudo apt-get --purge -y remove 'nvidia*'

updating and deleting unnecessary dependencies.

sudo apt-get update
sudo apt-get autoremove
sudo apt-get autoclean

Section 2 — Install Cuda

wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pinsudo mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600wget

--

--