提前安装依赖组件
检查Linux服务器上的VGA显卡信息,我们可以看到Nvidia GPU的具体型号
bash
lspci -nn | egrep -i "3d|display|vga"

修改/etc/apt/sources.list
,确保添加了contrib
、non-free
、 non-free-firmware
组件
bash
deb http://deb.debian.org/debian/ bookworm main contrib non-free non-free-firmware

先更新Linux并安装必要的编译组件
bash
sudo apt update -y && sudo apt upgrade -y && sudo apt install vim gcc g++ make python3-pip -y

安装必要的nvidia gpu驱动依赖组件
bash
sudo apt install -y
sudo apt install linux-headers-amd64 linux-headers-$(uname -r) build-essential -y

安装CUDA 12.3.1
打开CUDA Toolkit 12.3.1,选择Debian 12 X86_64版本并进行本地deb安装。

依次安装如下的命令
bash
wget https://developer.download.nvidia.com/compute/cuda/12.3.1/local_installers/cuda-repo-debian12-12-3-local_12.3.1-545.23.08-1_amd64.deb
sudo dpkg -i cuda-repo-debian12-12-3-local_12.3.1-545.23.08-1_amd64.deb
sudo cp /var/cuda-repo-debian12-12-3-local/cuda-*-keyring.gpg /usr/share/keyrings/
sudo apt install software-properties-common
sudo add-apt-repository contrib
sudo apt-get update
sudo apt-get -y install cuda-toolkit-12-3
bash
sudo apt-get install -y cuda-drivers
sudo apt install libglvnd-dev pkg-config firmware-misc-nonfree nvidia-kernel-dkms -y
安装完后进行检查
bash
nvidia-smi

这里我们就完成了CUDA的安装,关于cuDNN和TensorRT可以参考 Ubuntu版本的机器学习环境搭建部分,流程基本是一样的。