How to Install CUDA on Ubuntu 22.04?

Compute Unified Device Architecture or CUDA, is developed by NVIDIA to work as a parallel computing platform to harness the power of GPUs (NVIDIA only). It is used by developers to accelerate compute-intensive applications. CUDA is used in applications like Bioinformatics, Data Science, Machine Learning, Numerical Analysis, Imaging & Computer Vision, and more.

This guide explains the installation procedure of CUDA on Ubuntu 22.04.

  • What is CUDA?
  • How to Install CUDA on Ubuntu 22.04?
  • Verify if the GPU Supports CUDA
  • Verify if the CUDA is Supported on the Current Version
  • How to Uninstall CUDA on Ubuntu 22.04?

What is CUDA?

CUDA is a GPU compute API that performs a massive amount of parallel computing by harnessing the power of GPU (Graphics Processing Unit). It is a software component that gives direct access to the GPU’s virtual command to establish and parallelize computational elements for compute kernel operation. It consists of the following elements:

  • Tools (debuggers, profilers, IDEs).
  • Libraries (computing libraries).
  • API (to harness the power of an NVIDIA GPU).
  • Hardware (CUDA computes parallel architecture within the GPU).

Did you know?

The GPU has thousands of CUDA cores. For example, RTX 4080 has 18,432 CUDA cores) making it a powerful hardware tool for gaming, machine learning, and many other applications.

How to Install CUDA on Ubuntu 22.04?

Before moving on to the installation of CUDA on Ubuntu 22.04, there are a few things to be confirmed:

Verify if the GPU Supports CUDA

The CUDA is not supported on all GPUs, and to view the GPU installed on the system, use the below command:

$ lspci | grep -i nvidia

 The above command lists all the PCI devices connected to the system (lspci command) and then filter the output to show only the devices that have “NVIDIA” in their name or description (grep command_.

Now follow this link to find the list of supported GPUs by CUDA. 

Note: Some users reported that their GPU was not in the supported list, but they could still install and use CUDA.

Verify if the CUDA is Supported on the Current Version

Now check if CUDA is supported on the current version of Ubuntu (NVIDIA has stopped the support for 32-bit systems):

$ uname -m && cat /etc/*release

In the above image, the “x86_64” means that the system is 64-bit and supports CUDA and it is explained as:

  • uname prints the machine hardware name
  • cat /etc/*release displays the contents of the /etc/*release file, which contains information about the operating system release

Install CUDA on Ubuntu 22.04 LTS (64-bit)

To install CUDA on Ubuntu 22.04, use the “apt” command with the “install” utility by specifying the “nvidia-cuda-toolkit” package:

$ sudo apt install nvidia-cuda-toolkit

After a while, the installation process will be complete.

The above image confirms the installation of CUBA on Ubuntu 22.04.

How to Uninstall CUDA From Ubuntu 22.04?

To uninstall only the CUDA package, use the “remove” command by specifying the package name “nvidia-cuda-toolkit”:

$ sudo apt remove nvidia-cuda-toolkit

Note: The above command only removes the CUDA package, and all the dependencies, configurations, and data will still be there.

To remove CUDA from the system along with all the dependencies, configurations, and data, use the “autoremove” command with the “purge” utility as below:

$ sudo apt autoremove --purge nvidia-cuda-toolkit

The above command removes all the data related to CUDA on Ubuntu 22.04 LTS.


To install CUDA on Ubuntu, execute the “sudo apt install nvidia-cuda-toolkit” command. Before the installation, check the status of the GPU that supports the CUDA or not. The support for 32-bit systems has now ended, so install a 64-bit operating system by ensuring “i386” is not included in the ISO you are downloading. 

This guide explains the procedure for installing CUDA on Ubuntu 22.04.