Debian 11 裸机初始化与环境配置指南

裸机Debian 11初始化步骤

1. 更新APT的镜像,加快APT下载速度

使用阿里云镜像替换默认的Debian源,加速软件包下载:

bash 复制代码
sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list
apt update

2. 安装SSHD以便远程访问

首先更新APT包管理器并安装openssh-server

bash 复制代码
apt update
apt install openssh-server

接着备份并修改sshd配置文件以允许root登录和密码认证:

bash 复制代码
sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak
echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
echo "PasswordAuthentication yes" >> /etc/ssh/sshd_config

为root用户设置密码:

bash 复制代码
passwd root

创建运行目录并设置权限:

bash 复制代码
mkdir -p /run/sshd
chmod 0755 /run/sshd

启动sshd服务:

bash 复制代码
nohup /usr/sbin/sshd -e &

如果之前登录过并且需要清除旧的SSH密钥:

bash 复制代码
ssh-keygen -R xxx.xxx.xxx.xxx

连接到SSHD服务:

bash 复制代码
ssh root@xxx.xxx.xxx.xxx

3. Debian 11安装CUDA和NVIDIA驱动

首先更新系统并安装必备工具:

bash 复制代码
apt update && apt install sudo -y
apt install gcc g++ cmake pkg-config linux-headers* wget kmod

安装NVIDIA驱动

如果没有NVIDIA驱动,下载并运行NVIDIA驱动程序:

bash 复制代码
wget https://us.download.nvidia.com/XFree86/Linux-x86_64/530.30.02/NVIDIA-Linux-x86_64-530.30.02.run
sh NVIDIA-Linux-x86_64-530.30.02.run

如遇以下错误:

text 复制代码
ERROR: Unable to find the module utility `modprobe`; please make sure you have the package 'module-init-tools' or 'kmod' installed. If you do have 'module-init-tools' or 'kmod' installed, then please check that `modprobe` is in your PATH.

解决方法是安装kmod

bash 复制代码
apt install kmod -y

安装CUDA

下载并安装CUDA:

bash 复制代码
wget https://developer.download.nvidia.com/compute/cuda/12.1.0/local_installers/cuda_12.1.0_530.30.02_linux.run
sudo sh cuda_12.1.0_530.30.02_linux.run

配置环境变量:

bash 复制代码
vim ~/.bashrc

在文件末尾添加以下内容:

bash 复制代码
export PATH=$PATH:/usr/local/cuda-12.1/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-12.1/lib64

使配置生效:

bash 复制代码
source ~/.bashrc

验证CUDA安装:

bash 复制代码
nvcc -V

4. 安装Conda

下载并安装Miniconda:

bash 复制代码
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh

添加清华镜像源:

bash 复制代码
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/

5. 安装Git及Git LFS

使用APT安装Git和Git LFS:

bash 复制代码
apt install git
apt install git-lfs

6. 使用PIP安装相关依赖

使用PIP安装以下依赖包:

bash 复制代码
pip install xxx
复制代码
相关推荐
叶帆6 小时前
【YFIOs】Docker方式部署
运维·docker·容器
小猿姐7 小时前
Clickhouse Kubernetes Operator 实测:哪种方案更适合生产?
运维·数据库·kubernetes
彩色的黑'''7 小时前
[root@localhost ~]#,Linux系统的命令提示符为啥现在变成-bash-4.2#了,哪里设置的
linux·运维·bash
树下水月7 小时前
文件分片上传接口(Easyswoole)被nginx拦截,并返回状态码400和408的抓包排查过程
运维·nginx
南境十里·墨染春水8 小时前
linux学习进展 shell编程
linux·运维·学习
goyeer8 小时前
【ITIL4】32服务实践 - 问题管理(Problem Management)
linux·运维·服务器·企业数字化·it管理·itil·it治理
cen__y9 小时前
Linux11(网络编程)
linux·运维·服务器·c语言·网络·网络协议·tcp/ip
CableTech_SQH10 小时前
商业地产和高端酒店该怎么选综合布线解决方案?
运维·服务器·网络
xingyuzhisuan10 小时前
哪里可以一键部署Stable Diffusion XL的GPU云环境?(2026实测指南)
运维·人工智能·stable diffusion·gpu算力
Agent手记11 小时前
采购合同智能审核自动化,落地步骤与落地风险管控方案 —— 2026年企业级Agent深度实战指南
运维·人工智能·ai·自动化