How to install CUDA and Driver in the Server

服务器安装CUDA和驱动指南
部署运行你感兴趣的模型镜像

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

您可能感兴趣的与本文相关的镜像

PyTorch 2.5

PyTorch 2.5

PyTorch
Cuda

PyTorch 是一个开源的 Python 机器学习库,基于 Torch 库,底层由 C++ 实现,应用于人工智能领域,如计算机视觉和自然语言处理

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值