2022
我们一起努力

Debian系统升级教程:Debian 10服务器升级到Debian(debian8升级debian9)

Debian上周末发布的Debian 11.3是”Bullseye”系列的最新更新。Debian 11.3和以往的GNU/Linux point releases一样,只是提供错误修复和安全更新。11.3对Apache的log4j进行了安全修复,以解决去年年底臭名昭著的漏洞和后续问题。

Debian 11(Bullseye)是Debian Linux操作系统的新稳定版本,提供了广泛的更新软件包,并且提供五年的技术支持。本文介绍如何将现有的Debian 10服务器升级到 Debian 11,操作之前建议做好备份工作。此外,生产环境其实不建议直接这么升级,宁可选择重新部署。

一、更新现有服务器包

Debian 目前其实搬瓦工后台可以直接安装的,《搬瓦工 VPS有哪些操作系统可以选择?所有可选支持Linux系统列表》。

1、以具有sudo权限的普通用户身份通过 SSH 连接到服务器。

2、在从 Debian 10 切换之前更新您现有的服务器软件包、安全补丁和必要的升级是一个很好的做法,以确保您的应用程序与 Debian 11 兼容。

3、更新可用的软件包。

$ sudo apt update

4、升级所有现有的软件包。

$ sudo apt upgrade

5、删除任何不必要的依赖文件。

$ sudo apt autoremove
二、更改Debian源

Aptitude(Apt)从一个或多个存储库下载软件包以安装在您的服务器上(在 Debian 和 Ubuntu 中使用 APT 管理软件包)。 它会在/etc/apt/sources.list中找到要下载的正确存储库、可用软件包和版本。因此,您需要将/etc/apt/sources.list中的所有 Debian 10 代号替换为 Debian 11 代号。

1、通过运行以下命令确认 Debian 10 代号。Debian 10 的代号为 buster。

$ lsb_release -a

你的输出应该是:

No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 10 (buster)
Release: 10
Codename: buster

2、将源列表中的所有 buster 条目更改为 Bullseye,这是 Debian 11 的代号。

3、将原始配置文件备份到您的主目录。

$ sudo cp /etc/apt/sources.list ~/sources.bak
$ sudo cp -r /etc/apt/sources.list.d/ ~/sources.list.d.bak

4、在您喜欢的编辑器中打开/etc/apt/sources.list。

$ sudo nano /etc/apt/sources.list

5、当前条目应如下所示:

deb http://deb.debian.org/debian/ buster main
deb-src http://deb.debian.org/debian/ buster main
deb http://security.debian.org/debian-security buster/updates main
deb-src http://security.debian.org/debian-security buster/updates main
# buster-updates, previously known as 'volatile'
deb http://deb.debian.org/debian/ buster-updates main
deb-src http://deb.debian.org/debian/ buster-updates main

将这些行替换为:

deb http://deb.debian.org/debian bullseye main
deb-src http://deb.debian.org/debian bullseye main
deb http://security.debian.org/ bullseye-security main
deb-src http://security.debian.org/ bullseye-security main
deb http://deb.debian.org/debian bullseye-updates main
deb-src http://deb.debian.org/debian bullseye-updates main

6、保存并关闭文件。

7、再次更新软件包列表。如果您正确地进行了更改,则在更新过程中不会显示任何错误。

$ sudo apt update

8、执行系统升级。使用–without-new-pkgs标志来避免删除您打算保留在服务器上的软件包。

$ sudo apt upgrade --without-new-pkgs

系统将提示您重新启动特定服务或保留和删除特定配置选项。回答 Yes。

9、安装 apt-listchanges 包后,它将显示有关升级包的信息。键入 Q 退出。

10、选择一个控制台编码集,然后继续进行其他升级。

三、Debian 系统升级教程

现在,您可以使用以下命令安全地运行到 Debian 11 的完整升级:

$ sudo apt full-upgrade

这会将服务器从 Debian 10 完全升级到 Debian 11,解决可能的依赖关系更改,安装所有软件包的最新版本,并删除所有过时的软件包。在系统升级过程中,可能会显示其他提示以重新启动服务和更新现有配置选项。请务必选择适当的选项以避免对现有应用程序进行不必要的更改。

当显示寻呼机指示器 : 时,键入 Q 继续。

当提示修改/etc/sysctl.conf时键入 Y。

Configuration file '/etc/sysctl.conf'
== Modified (by you or by a script) since installation.
== Package distributor has shipped an updated version.
What would you like to do about it ? Your options are:
Y or I : install the package maintainer's version
N or O : keep your currently-installed version
D : show the differences between the versions
Z : start a shell to examine the situation
The default action is to keep your current version.
四、重启服务器

1、系统升级完成后,重新启动服务器以使更改生效。

$ sudo reboot now

您当前的 SSH 连接将被删除。

2、等待一分钟,让服务器重新启动。

3、通过 SSH 登录。

4、检查当前的操作系统版本并验证它是否显示 Debian 11,bullseye。

$ lsb_release -a

输出:

No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 11 (bullseye)
Release: 11
Codename: bullseye
五、验证应用程序和服务

在升级过程中,一些软件包可能已经升级到较新的版本,但它们仍将使用相同的配置文件和端口。逐一验证您现有的应用程序,并根据您的服务器设置检查错误日志。例如,检查Apache2 是否已安装并运行:

$ sudo service apache2 status

要确认MySQL是否存在:

$ sudo service mysql status

检查当前PHP版本:

$ php -v
六、服务器安全设置

在从 Debian 10 升级到 Debian 11 的过程中,一些应用程序可能需要新版本。根据您的安装类型,一些应用程序可能已在此过程中自动更新,或者您可能必须手动更新最新版本。 要保护服务器,请删除所有过时的软件包。

$ sudo apt --purge autoremove

确认简单防火墙(ufw) 是否正在运行并设置一些规则以加强与服务器的连接。

$ sudo ufw status

要允许HTTP之类的服务,请运行:

$ sudo ufw allow http

现在已经将服务器从 Debian 10 “Buster”升级到 Debian 11 “Bullseye”,并在服务器上保留了现有应用程序。

来源:zyhot.com/article/13656.html

本站声明:内容来源于网络,内容不代表本站立场,仅供阅读参考,文章版权归原作者“本公司cmy.cn”所有。如有侵权,请联系我们删除。

免责声明:本站发布的内容(图片、视频和文字)以原创、来自本网站内容采集于网络互联网转载等其它媒体和分享为主,内容观点不代表本网站立场,如侵犯了原作者的版权,请告知一经查实,将立刻删除涉嫌侵权内容,联系我们56dr_com,同时欢迎投稿传递力量。

本文从“特网科技(56dr.com)”转载,原作者保留一切权利,若侵权请联系删除。

赞(0)
文章名称:《Debian系统升级教程:Debian 10服务器升级到Debian(debian8升级debian9)》
文章链接:https://www.fzvps.com/145392.html
本站文章来源于互联网,如有侵权,请联系管理删除,本站资源仅供个人学习交流,请于下载后24小时内删除,不允许用于商业用途,否则法律问题自行承担。
图片版权归属各自创作者所有,图片水印出于防止被无耻之徒盗取劳动成果的目的。

评论 抢沙发

评论前必须登录!