Install CUDA for Ubuntu in 5 mins
One tweet from https://twitter.com/finbarrtimbers says:
I enjoyed the CUDA driver installation for 2 days plus another day to reinstall the whole system around 2 years ago.
Now in 2023, with the correct steps, you can only enjoy CUDA drivers installation for just 5 mins in Ubuntu, here are the steps:
Step 1. If you have Nvidia’s driver already installed, you’d better uninstall all Nvidia drivers first to ensure minimum errors.
sudo apt-get purge 'nvidia*'
sudo apt-get autoremove
Then reboot your system:
sudo reboot
You may want to disable the UEFI secure boot from the BIOS, if not doing it, you will be asked to input a password and then enroll the key, it will work, but require additional steps and may lead to driver installation failure.
Step 2. Install GCC if you don’t have one
sudo apt install gcc
Step 3. Install NVIDIA GPU driver
sudo apt update
sudo apt upgrade
sudo apt install build-essential dkms
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt update
# list all avaliable drivers
sudo apt install ubuntu-drivers-common
sudo ubuntu-drivers devices
# auto install
sudo ubuntu-drivers autoinstall
# or with a version
#…