Install CUDA for Ubuntu in 5 mins

Andrew Zhu
2 min readMay 14, 2023

One tweet from https://twitter.com/finbarrtimbers says:

Source: https://twitter.com/finbarrtimbers/status/1657154970213572608

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

You don’t have to reboot system after purging, in case you don’t have the CPU integrated GPU like many Intel CPUs have, you may have display troubles after rebooting before having new GPU drivers installed.

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
# sudo apt install nvidia-driver-525

--

--

Andrew Zhu
Andrew Zhu

Written by Andrew Zhu

Andrew is working on AI stuffs | a HF Diffusers contributor | a ex-Data Scientist@MS | His LinkedIn is www.linkedin.com/in/andrew-zhu-23407223/

Responses (1)