debian正式发布了,还在debian12的用户可以考虑升级到debian13了。主机测评在这里介绍最简单的升级办法,复制、粘贴、回车即可!注意:数据无价,备份了再升级,避免出现错误导致不必要的损失。

第一步:先升级现有系统组件

apt update

apt upgrade

apt full-upgrade

第二步:清理废物

apt –purge autoremove

然后重启: reboot

第三步:确认当前版本

cat /etc/debian_version

确定你当前已经是最新的debian12了,别搞了半天还是debian11或者其他

第四步:修改源文件

sed -i ‘s/bookworm/trixie/g’ /etc/apt/sources.list

sed -i ‘s/bookworm/trixie/g’ /etc/apt/sources.list.d/*

或者你干脆替换吧,国内用:

cat > /etc/apt/sources.list << EOF
deb https://mirrors.huaweicloud.com/debian/ trixie main non-free non-free-firmware contrib
deb-src https://mirrors.huaweicloud.com/debian/ trixie main non-free non-free-firmware contrib
deb https://mirrors.huaweicloud.com/debian-security/ trixie-security main
deb-src https://mirrors.huaweicloud.com/debian-security/ trixie-security main
deb https://mirrors.huaweicloud.com/debian/ trixie-updates main non-free non-free-firmware contrib
deb-src https://mirrors.huaweicloud.com/debian/ trixie-updates main non-free non-free-firmware contrib
deb https://mirrors.huaweicloud.com/debian/ trixie-backports main non-free non-free-firmware contrib
deb-src https://mirrors.huaweicloud.com/debian/ trixie-backports main non-free non-free-firmware contrib
EOF

海外用:

cat > /etc/apt/sources.list << EOF
deb http://mirrors.linode.com/debian/ trixie main non-free non-free-firmware contrib
deb-src http://mirrors.linode.com/debian/ trixie main non-free non-free-firmware contrib
deb http://mirrors.linode.com/debian-security/ trixie-security main
deb-src http://mirrors.linode.com/debian-security/ trixie-security main
deb http://mirrors.linode.com/debian/ trixie-updates main non-free non-free-firmware contrib
deb-src http://mirrors.linode.com/debian/ trixie-updates main non-free non-free-firmware contrib
deb http://mirrors.linode.com/debian/ trixie-backports main non-free non-free-firmware contrib
deb-src http://mirrors.linode.com/debian/ trixie-backports main non-free non-free-firmware contrib
EOF

接下来回车执行,然后更新过程中根据需要选择是或者否升级你需要升级的,实在不懂就一路yes+回车 !

最后一步:清理废物

apt –purge autoremove

apt autoclean

再次提醒:升级之前备份你的数据,别搞翻车了没办法后悔!

如果机器上没有重要的东西,你可以直接从第四步开始执行!