
Debian 12 Bookworm 升级 Debian 13 Trixie
本文最后更新于 2025-08-19,文章内容可能已经过时。
本文将指导如何升级 **Debian 12 Bookworm** 到 **Debian 13 Trixie**。
相关教程:[Debian 11 Bullseye 升级 Debian 12 Bookworm](https://u.sb/debian-upgrade-12)。
## ⚠️ 准备工作(必看)
- **备份!备份!备份!**
云主机请打快照,物理机请用 `rsync`、`borg`、`timeshift` 等备份系统盘。
- **OpenVZ 6 / LXC** 无法升级,因为他们没有独立内核。
- **全程 root**
```bash
sudo -i
1️⃣ 先把 12 升到最新
apt update
apt upgrade -y
apt full-upgrade -y
apt autoclean
apt autoremove -y
如果更新了 可以重启一次
reboot
2️⃣ 修改软件源(bookworm → trixie)
🔹 传统 One-Line 格式(多数机器)
bash
复制
sed -i 's/bookworm/trixie/g' /etc/apt/sources.list
sed -i 's/bookworm/trixie/g' /etc/apt/sources.list.d/*.list
sed -i 's/bookworm/trixie/g' /etc/apt/sources.list.d/*.sources 2>/dev/null || true
完成后 /etc/apt/sources.list
应类似:
Text
复制
deb https://deb.debian.org/debian trixie main contrib non-free non-free-firmware
deb https://security.debian.org/debian-security trixie-security main contrib non-free non-free-firmware
deb https://deb.debian.org/debian trixie-updates main contrib non-free non-free-firmware
国内服务器可替换为清华镜像:
Text
复制
mirrors.tuna.tsinghua.edu.cn
🔹 DEB822 格式(推荐)
新建或覆盖 /etc/apt/sources.list.d/debian.sources
:
Tex
复制
Types: deb
URIs: https://deb.debian.org/debian
Suites: trixie trixie-updates trixie-backports
Components: main contrib non-free non-free-firmware
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
Types: deb
URIs: https://security.debian.org/debian-security
Suites: trixie-security
Components: main contrib non-free non-free-firmware
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
然后删除旧文件:
bash
复制
rm -f /etc/apt/sources.list
3️⃣ 真正开始升级
bash
复制
apt update
apt upgrade -y
apt full-upgrade -y
libc6 重启服务提示:
个人/测试机 → 选 Yes
生产机 → 选 No(稍后手动重启)
配置文件冲突(例如 sshd_config)
按
D
查看差异 → 合并或保留 → 回车继续
4️⃣ 清理 & 重启
bash
复制
apt autoclean
apt autoremove -y
reboot
5️⃣ 验证结果
bash
复制
cat /etc/debian_version # 13.0
lsb_release -a # Debian GNU/Linux 13 (trixie)
uname -a # 6.12.38+deb13-cloud-amd64 或更新
6️⃣ 安装编译环境(可选)
bash
复制
apt install -y build-essential \
libssl-dev zlib1g-dev libbz2-dev libreadline-dev \
libsqlite3-dev libncurses5-dev libncursesw5-dev \
tk-dev libffi-dev liblzma-dev
7️⃣ 一键速查表
表格
复制
恭喜,你已经成功升级到 Debian 13 Trixie!
欢迎把本文分享给更多需要的小伙伴。
- 感谢你赐予我前进的力量
赞赏者名单
因为你们的支持让我意识到写文章的价值🙏
本文是原创文章,采用 CC BY-NC-ND 4.0 协议,完整转载请注明来自 天空的小窝
评论
匿名评论
隐私政策
你无需删除空行,直接评论以获取最佳展示效果