「Debian」- 操作系统升级(通用方法) @20210425

问题描述

我们需要升级操作系统,升级 Debian 8.3 到 Debian 9.13 版本,后来我们又升级到 Debian 10 版本。

该文档将记录:我们升级 Debian 8.3 到 Debian 9.13 到 Debian 10 版本的过程,并展示出通用的升级方法。

注意事项

1)在升级前,请先进行数据备份,防止系统升级失败或其他原因,而带来损失;
2)如果没有必要,不建议升级操作系统;
3)需要注意的事项及经验教训,参考 Experience of Software Upgrades 笔记;

解决方案

对于跨版本升级,需要逐步进行。

第一步、Debian 8.3 => Debian 9.13

# 更新系统,以使其为当前版本最新
apt-get update
apt-get upgrade
apt-get dist-upgrade
reboot

# 设置新的软件源
cat > /etc/apt/sources.list.d/debian-9.list
deb http://mirrors.tencentyun.com/debian stretch main contrib non-free
deb http://mirrors.tencentyun.com/debian stretch-updates main contrib non-free
deb http://mirrors.tencentyun.com/debian-security stretch/updates main
EOF

# 更新系统,以更新到新版本
apt-get update
apt-get upgrade
apt-get dist-upgrade
reboot

# 验证升级成功
lsb_release -d

第二步、Debian 9.13 => Debian 10

# 更新系统,以使其为当前版本最新
apt-get update
apt-get upgrade
apt-get dist-upgrade
reboot

# 设置新的软件源
cat > /etc/apt/sources.list.d/debian-10.list
deb http://mirrors.tencentyun.com/debian buster main contrib non-free
deb http://mirrors.tencentyun.com/debian buster-updates main contrib non-free
deb http://mirrors.tencentyun.com/debian-security buster/updates main
EOF

# 更新系统,以更新到新版本
apt-get update
apt-get upgrade
apt-get dist-upgrade
reboot

# 验证升级成功
lsb_release -d

注意事项

我们使用 mirrors.tencentyun.com 站点是因为我们的主机在腾讯云中,这里需要按需调整。如下为官方仓库:

deb http://httpredir.debian.org/debian stretch main contrib non-free
deb http://httpredir.debian.org/debian stretch-updates main contrib non-free
deb http://security.debian.org stretch/updates main contrib non-free

在升级过程中,总会遇到各种问题,需要根据实际情况处理。如果不能承担风险,或者处理突发问题存在困难,则不建议升级。

参考文献

How to Upgrade Debian 8 Jessie to Debian Linux 9 Stretch {safely}
How to upgrade Debian 9 to Debian 10 Buster using the CLI - nixCrafts


posted @ 2021-04-25 21:50  研究林纳斯写的  阅读(1685)  评论(0编辑  收藏  举报