How to install Cuda 11.4 on ubuntu 18.04(or 20.04)
3 min readJul 17, 2021
I need to install Cuda on ubuntu and I installed it on Centos 7 before without any issue. There were some issues on ubuntu and I will write down them.
If you already installed Cuda and there were errors (or some issues) do these commands or skip this section (section 1)
Section 1 — Cleaning 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*
updating and deleting unnecessary dependencies.
sudo apt-get update
sudo apt-get autoremove
sudo apt-get autoclean
Section 2 — Installing Cuda
For 18.04
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…