Please follw the guide step by step carefully
NVIDIA drivers
1.Purge all existing NVIDIA drivers (including artifacts)
sudo apt purge -y 'nvidia*' 'libnvidia-*'
sudo apt autoremove -y
sudo apt clean
2.Check no leftovers remain:
dpkg -l | grep -i nvidia
3.Add the Official NVIDIA PPA
This ensures you get the latest stable drivers beyond Ubuntu defaults:
sudo add-apt-repository ppa:graphics-drivers/ppa -y
sudo apt update
Then run the follow code,the driver-version (555)you need to choose
sudo apt install -y nvidia-driver-555
sudo reboot
nvidia-smi
If it can’t not work ,turn into the 4 step
4.Install required build tools
sudo apt update
sudo apt install -y build-essential dkms libglvnd-dev pkg-config
5.Download the NVIDIA Driver 570 .run file
Use wget with a known working link:
wget https://download.nvidia.com/XFree86/Linux-x86_64/570.153.02/NVIDIA-Linux-x86_64-570.153.02.run
chmod +x NVIDIA-Linux-x86_64-570.153.02.run
6.Reboot into non-graphical mode (safe install)
sudo systemctl isolate multi-user.target
7.Run the installer
sudo ./NVIDIA-Linux-x86_64-570.153.02.run
8.Reboot after installation
sudo reboot
9.Verify the driver is active
nvidia-smi
Cuda 12.9
Here is the example about how to install cuda12.9,and you can choose the version by yourself.
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64/cuda-ubuntu2404.pin
sudo mv cuda-ubuntu2404.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget https://developer.download.nvidia.com/compute/cuda/12.9.1/local_installers/cuda-repo-ubuntu2404-12-9-local_12.9.1-575.57.08-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu2404-12-9-local_12.9.1-575.57.08-1_amd64.deb
sudo cp /var/cuda-repo-ubuntu2404-12-9-local/cuda-*-keyring.gpg /usr/share/keyrings/
sudo apt-get update
sudo apt-get -y install cuda-toolkit-12-9
echo 'export PATH=/usr/local/cuda-12.9/bin${PATH:+:${PATH}}' >> ~/.bashrc
source ~/.bashrc
nvcc -V
服务器安装CUDA和驱动指南
1239

被折叠的 条评论
为什么被折叠?



