If you are struggling to setup NVIDIA drivers or NVIDIA CUDA environment in Linux and does not find a complete solution then this guide is for you. This Guide have two parts; first, Installing NVIDIA drivers and second, setting up NVIDIA CUDA toolkit. This guide is tested on Fedora 34 and may or may not work on other Linux distros.
This is the second part of the guide which is installing NVIDIA CUDA toolkit which requires NVIDIA drivers installed. If you don't have NVIDIA drivers installed already, then following the first part of this guide before continuing. You can verify your NVIDIA driver installation by running the below command.
The output should be similar to the given below if you have valid Nvidia drivers installed.
Update your system by running the following commands and reboot.
NOTE: below command will update and install some dependencies for your system and reboot it.
sudo dnf update
sudo dnf upgrade
dnf install gcc-c++ mesa-libGLU-devel libX11-devel libXi-devel libXmu-devel freeglut freeglut-devel
♦Step 1 ~ NVIDIA CUDA Toolkit Install Guide
chmod +x cuda*.run
sudo sh cuda*.run --override
# sudo sh cuda_11.2.2_460.32.03_linux.run --override
Follow the installation prompts (Choose accept)
uncheckDriver and select Install
Add CUDA to system path variable
I am using zsh as my shell, so I add this to my '~/.zshrc'. You can also put below lines in your '~/.bashrc' or ~/.profile'.
You can verify your NVIDIA CUDA Toolkit installation by running below command
The output should be similar to the given below if everything have been done smoothly.
To uninstall the NVIDIA CUDA Toolkit, run below Command
You should have successfully installed NVIDIA drivers and NVIDIA CUDA Toolkit.
Leave a comment below if you have any question or suggestions.
Happy Posting! See you in the next one.