- Posted on
- • Administration
Installing CUDA across RHEL, Ubuntu, and openSUSE
- Author
-
-
- User
- Linux Bash
- Posts by this author
- Posts by this author
-
Installing CUDA on Linux: A Step-by-Step Guide for RHEL, Ubuntu, and openSUSE
The CUDA (Compute Unified Device Architecture) platform from NVIDIA is a powerful toolset that enables dramatic increases in computing performance by harnessing the power of the graphics processing unit (GPU). Whether you're involved in data science, machine learning, or other intensive computational tasks, installing CUDA can substantially accelerate your processes. This guide provides detailed instructions on how to install CUDA on three popular Linux distributions: Red Hat Enterprise Linux (RHEL), Ubuntu, and openSUSE.
Common Prerequisites
Before diving into the specific steps for each distribution, ensure your system meets the following: 1. An NVIDIA GPU with a CUDA compute capability of 3.5 or higher. 2. Ensure that your system is updated and that you have the necessary rights (typically root access) to install software.
Ubuntu (Using apt
)
Ubuntu, being one of the most popular Linux distributions, provides a straightforward method for installing CUDA through its package manager, apt
.
Add NVIDIA package repositories First, you'll need to add the NVIDIA package repositories that include the CUDA toolkit.
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin sudo mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600 sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub sudo add-apt-repository "deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/ /" sudo apt-get update
Install CUDA
sudo apt-get -y install cuda
Configure your environment Add the following lines to the end of your
.bashrc
file:export PATH=/usr/local/cuda-11.0/bin${PATH:+:${PATH}} export LD_LIBRARY_PATH=/usr/local/cuda-11.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
Reboot Reboot your system to apply all changes:
sudo reboot
Red Hat Enterprise Linux (RHEL) (Using dnf
)
For RHEL, the recommended way is to use the dnf
package manager. The process differs slightly from that used in Ubuntu.
Enable the CUDA repository
sudo dnf config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel7/x86_64/cuda-rhel7.repo
Install CUDA
sudo dnf clean all sudo dnf -y module install nvidia-driver:latest-dkms sudo dnf -y install cuda
Configure your environment as described for Ubuntu
Reboot your system
openSUSE (Using zypper
)
In openSUSE, zypper
is used as the package manager to handle installations.
Add the NVIDIA CUDA repository
sudo zypper addrepo https://developer.download.nvidia.com/compute/cuda/repos/opensuse15/x86_64/cuda-opensuse15.repo
Refresh and install CUDA
sudo zypper refresh sudo zypper install cuda
Configure your environment as per the instructions given for Ubuntu
Reboot your system
Post-Installation
After installation, it's a good practice to verify that the installation was successful. Run:
nvidia-smi
This command should display information about the NVIDIA driver and GPU device.
Conclusion
Installing CUDA across different Linux distributions involves similar steps: adding the NVIDIA repository, installing CUDA, configuring the environment, and rebooting the system. By following these steps, you can equip your Ubuntu, RHEL, or openSUSE system with CUDA and take advantage of GPU-accelerated computing for your applications. Enjoy the power of parallel GPU computing!