工程板装Debian13.6
Debian 13.6 安装与网络配置完整笔记
本文档基于实际安装过程整理,涵盖从系统安装到 SSH 远程登录的完整流程,包含所有遇到的错误及解决办法。
一、安装前的准备
1. 下载镜像
- 推荐使用网络安装版(netinst ISO)
- 下载地址:https://www.debian.org/distrib/
2. 制作启动盘
- Windows:使用 Rufus 写入 U 盘
- Linux/macOS:使用 dd 命令写入
- 注意:此操作会清空 U 盘所有数据
3. BIOS/UEFI 设置
- 重启电脑,按 Del / F2 进入 BIOS
- 将 U 盘设为第一启动项
- 保存并退出
二、分区方案(UEFI 模式)
正确分区结构,选U盘启动后,第一个图形界面安装,install是命令行界面,貌似有些装不上,选自动分区,手动efi有问题
| 分区 | 大小 | 类型 | 挂载点 |
|---|---|---|---|
| #1 | 500MB - 1GB | EFI System Partition | /boot/efi |
| #2 | 剩余空间(建议 20GB+) | Ext4 | / |
| #3 | 等于内存大小(或 8GB) | swap | swap |
分区操作步骤
- 进入分区界面后,删除所有现有分区,变为 FREE SPACE
- 创建 #1:选 EFI System Partition,设置 Bootable flag 为 on
- 创建 #2:选 Ext4,挂载点选 /
- 创建 #3:Use as 选 swap area
- 选 Finish partitioning and write changes to disk
- 确认写入选 Yes
三、安装过程中的关键选项
1. 网络镜像选择
- 提示 "Continue without a network mirror" 时选 Yes
- 原因:先装最小系统,后续换国内源更快
2. 软件包流行度调查
- "Participate in the package usage survey" 选 No
3. 软件选择
- 必须勾选 Standard system utilities
- 桌面环境在之前步骤已选,此处不重复
四、安装 GRUB 引导
常见错误及处理
错误1:No EFI partition was found
- 原因:BIOS 模式与分区不匹配
- 解决:确认主板为 UEFI 模式,需创建 ESP 分区
错误2:Unable to install GRUB in dummy
- 原因:缺少 EFI 系统分区
- 解决:按上述分区方案重新分区
错误3:mount /boot/efi failed
- 原因:ESP 分区未正确初始化
- 解决:在分区设置中将 Bootable flag 设为 on
如果 GRUB 反复安装失败
进入救援模式(Rescue mode)手动安装:
- 从 U 盘启动,选 Rescue mode
- 选 /dev/sda2 作为 root 文件系统
- 选 "Execute a shell in /dev/sda2"
- 执行以下命令:
chroot /mnt /bin/bash
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=Debian
update-grub
exit
exit- 重启系统,拔掉 U 盘
五、首次进入系统后的网络配置,最简系统,没有ip和ssh
1. 检查网卡状态
ip a2. 启用网卡
ip link set enp2s0 up
无法自动获取IP,手动指定
ip addr add 192.168.1.100/24 dev enp2s0
ip route add default via 192.168.1.1
echo "nameserver 223.5.5.5" > /etc/resolv.conf
echo "nameserver 8.8.8.8" >> /etc/resolv.conf
测试
ping -c 4 223.5.5.53. 配置软件源(重要)
Debian 13 的代号为 trixie,需使用正确的源:
cat > /etc/apt/sources.list << 'EOF'
deb https://mirrors.tuna.tsinghua.edu.cn/debian trixie main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian trixie-updates main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security trixie-security main contrib non-free non-free-firmware
EOF4. 更新软件包列表
apt update5. 安装网络工具
apt install isc-dhcp-client ifupdown net-tools -y6. 配置网卡开机自动获取 IP
编辑网络配置文件:
nano /etc/network/interfaces添加以下内容:
auto enp2s0
iface enp2s0 inet dhcp保存退出(nano 快捷键:Ctrl+X,按 Y,按 Enter)
7. 重启网络服务
systemctl restart networking8. 手动获取 IP(如果需要)
dhclient -v enp2s09. 验证网络连通性
ping -c 4 223.5.5.5
ping -c 4 www.baidu.com六、开启 SSH 远程登录
1. 安装 SSH 服务端
apt install openssh-server -y2. 查看本机 IP
ip a show enp2s0记下 inet 后面的地址(如 192.168.10.202)
3. 启动 SSH 并设置开机自启
systemctl enable ssh --now4. 检查服务状态
systemctl status ssh显示 active (running) 表示成功
5. 从其他设备登录
Windows(CMD 或 PowerShell):
ssh root@192.168.10.202Mac / Linux:
ssh root@192.168.10.202七、常见问题及解决方案
问题1:安装 GRUB 时提示 "No EFI partition was found"
原因:硬盘分区表中没有 EFI 系统分区
解决:按正确分区方案重新分区,确保 ESP 分区存在
问题2:apt install 报依赖错误
错误示例:
Unsatisified dependencies:
apt : Depends: libapt-pkg7.0 (>= 3.0.3) but it is not going to be installed原因:软件源版本与系统版本不匹配(如用 bookworm 源装 trixie 系统)
解决:将源中的 bookworm 改为 trixie
问题3:网卡状态为 DOWN
ip link set enp2s0 up问题4:USB 网卡 error -71
原因:USB 端口供电不足或驱动问题
解决:
modprobe -r ax88179_178a
modprobe ax88179_178a
ip link set enx00e0c6f012b2 up
dhclient -v enx00e0c6f012b2问题5:重启后网卡未自动获取 IP
原因:未将网络配置写入配置文件
解决:按第五部分第6步配置 /etc/network/interfaces
问题6:sudo: command not found
原因:最小化系统未安装 sudo
解决:切换到 root 用户(su -),安装 sudo:
apt install sudo -y
usermod -aG sudo 用户名问题7:dhclient: command not found
解决:
apt install isc-dhcp-client -y八、系统信息确认
查看 Debian 版本:
cat /etc/debian_version查看内核版本:
uname -a查看网卡 IP:
ip a九、注意事项
- Debian 13 的稳定版代号为 trixie,软件源中应使用 trixie 而非 bookworm
- UEFI 模式下必须存在 ESP 分区,类型选 EFI System Partition
- 最小化安装后需手动安装网络工具和 SSH 服务
- 网卡配置需写入 /etc/network/interfaces 才能开机自启
- 使用国内镜像源(清华、中科大等)可大幅提升下载速度
以上内容基于 Debian 13.6 安装过程完整记录,所有命令均已实际验证。