Enter the CUDA download page of the nvidia developer website:
CUDA Toolkit Archive | NVIDIA Developer
Select the CUDA file in runfile format to download. After the download is complete, unzip it and run the command in the picture above. There will be terms, just accept it. Be careful not to install the driver when installing CUDA (because we have already installed it in the first step) .
Then,
sudo vim ~/.bashrc
We add in the last line of the file:
export PATH="/usr/local/cuda-11.7/bin:$PATH"
export LD_LIBRARY_PATH="/usr/lcoal/cuda-11.7/lib64:$LD_LIBRARY_PATH"
Finally, make the configuration just now take effect.
source ~/.bashrc
Enter the /usr/local/cuda-10.1/samples/1_Utilities/ directory and test:
sudo make
cd deviceQuery
./deviceQuery
If the following output appears, CUDA is installed successfully.
Install cuDNN
entering download page
cuDNN Archive | NVIDIA Developer
sudo dpkg -i sudo dpkg -i libcudnn7_7.6.5.32-1+cuda10.2_amd64.deb
sudo dpkg -i sudo dpkg -i libcudnn7_7.6.5.32-1+cuda10.2_amd64.deb
sudo dpkg -i sudo dpkg -i libcudnn7_7.6.5.32-1+cuda10.2_amd64.deb
sudo dpkg -l | grep cudnn