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
复制代码
相关推荐
JZC_xiaozhong1 天前
数据不互通、审批慢?企业多系统智能协同与流程自动化解决方案
运维·自动化·流程管理·流程自动化·数据集成与应用集成·流程监控·流程可视化设计
爱学习的小囧1 天前
ESXi 8.0 原生支持 NVMe 固态硬盘吗?VMD 配置详解教程
linux·运维·服务器·esxi·esxi8.0
坚持就完事了1 天前
Linux中的变量
linux·运维·服务器
hERS EOUS1 天前
nginx 代理 redis
运维·redis·nginx
Cat_Rocky1 天前
利用Packet Tracer网络实验
linux·运维·服务器
嵌入式×边缘AI:打怪升级日志1 天前
Linux 驱动实战:SR501 人体红外传感器驱动开发与调试全记录
linux·运维·驱动开发
正点原子1 天前
【正点原子Linux连载】第三章 U-Boot使用 摘自【正点原子】ATK-DLRK3568嵌入式Linux驱动开发指南
linux·运维·驱动开发
忍冬行者1 天前
MongoDB 三节点副本集离线部署运维手册
运维·数据库·mongodb
爱学习的小囧1 天前
ESXi VMkernel 端口 MTU 最佳设置详解
运维·服务器·网络·php·虚拟化
Elastic 中国社区官方博客1 天前
Elastic Security、Observability 和 Search 现在在你的 AI 工具中提供交互式 UI
大数据·运维·人工智能·elasticsearch·搜索引擎·安全威胁分析·可用性测试