mirror of
https://github.com/LCTT/TranslateProject.git
synced 2024-12-26 21:30:55 +08:00
199 lines
7.0 KiB
Markdown
199 lines
7.0 KiB
Markdown
|
[#]: subject: "How to Upgrade to Debian 12 from Debian 11"
|
|||
|
[#]: via: "https://www.debugpoint.com/upgrade-debian-12-from-debian-11/"
|
|||
|
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
|
|||
|
[#]: collector: "lkxed"
|
|||
|
[#]: translator: "ChatGPT"
|
|||
|
[#]: reviewer: "wxy"
|
|||
|
[#]: publisher: "wxy"
|
|||
|
[#]: url: "https://linux.cn/article-15902-1.html"
|
|||
|
|
|||
|
从 Debian 11 升级到 Debian 12
|
|||
|
======
|
|||
|
|
|||
|
![][0]
|
|||
|
|
|||
|
> 以下是如何从 Debian 11 升级到 Debian 12 “Bookworm” 的步骤。
|
|||
|
|
|||
|
Debian 12 Bookworm 已经发布。如果你正在运行 Debian 11 “Bullseye”,你可以计划现在升级你的台式机或服务器。但是,建议你等待 Debian “Bookworm” 的第一个小版本,即 12.1 版本,再进行关键服务器升级。
|
|||
|
|
|||
|
话虽如此,如果你想了解 Debian 12 的新特性,可以查看 [这篇文章][1]。以下是详细的升级步骤:
|
|||
|
|
|||
|
### 从 Debian 11 升级到 Debian 12
|
|||
|
|
|||
|
无论你运行的是 Debian 服务器还是任何桌面版本,请确保备份关键数据。例如,你可能需要为桌面文档进行备份。如果是服务器,请记录正在运行的服务。你可以使用 `rsync` 或其他实用工具来完成此操作。
|
|||
|
|
|||
|
Debian 12 引入了一个名为 `non-free-firmware` 的新仓库,用于专有驱动程序和软件包。如果你使用任何“闭源”的网络、显示、图形或其他驱动程序,你可能需要在升级后进行配置。
|
|||
|
|
|||
|
对于网络驱动程序,请确保在某个地方安全地记录 `/etc/network/interfaces` 和 `/etc/resolv.conf` 文件的内容。如果在升级完成后失去了网络连接,可以 [按照这个指南][2] 轻松设置它。
|
|||
|
|
|||
|
从命令提示符运行以下命令,以确保 Debian 11 更新了安全和其他软件包:
|
|||
|
|
|||
|
```
|
|||
|
sudo apt update
|
|||
|
sudo apt upgrade
|
|||
|
sudo apt full-upgrade
|
|||
|
sudo apt autoremove
|
|||
|
```
|
|||
|
|
|||
|
完成上述命令后,重新启动 Debian 11 系统:
|
|||
|
|
|||
|
```
|
|||
|
sudo systemctl reboot
|
|||
|
```
|
|||
|
|
|||
|
记下关于 Debian 11 的几个信息。这对于服务器很重要。它们包括内核版本和 Debian 版本。这是因为升级后,你可以验证下面的相同命令以确保升级成功。
|
|||
|
|
|||
|
例如,我尝试升级的系统是 Debian 11.7,内核版本为 5.10。
|
|||
|
|
|||
|
```
|
|||
|
uname -mr
|
|||
|
```
|
|||
|
|
|||
|
示例输出:
|
|||
|
|
|||
|
```
|
|||
|
5.10.0-23-amd64 x86_64
|
|||
|
```
|
|||
|
|
|||
|
```
|
|||
|
cat /etc/debian_version
|
|||
|
```
|
|||
|
|
|||
|
示例输出:
|
|||
|
|
|||
|
```
|
|||
|
11.7
|
|||
|
```
|
|||
|
|
|||
|
将 APT 源文件备份到你选择的任何目录:
|
|||
|
|
|||
|
```
|
|||
|
sudo cp -v /etc/apt/sources.list /home/arindam/
|
|||
|
sudo cp -vr /etc/apt/sources.list.d/ /home/arindam/
|
|||
|
```
|
|||
|
|
|||
|
打开 `/etc/apt/sources.list` 文件,并将 Debian 12 的代号 `bookworm` 添加到该文件中,替换 `bullseye`。
|
|||
|
|
|||
|
```
|
|||
|
sudo nano /etc/apt/sources.list
|
|||
|
```
|
|||
|
|
|||
|
以下是我测试系统中的 `/etc/apt/sources.list` 文件**更改之前**的内容作为参考:
|
|||
|
|
|||
|
```
|
|||
|
deb http://deb.debian.org/debian/ bullseye main
|
|||
|
deb-src http://deb.debian.org/debian/ bullseye main
|
|||
|
|
|||
|
deb http://security.debian.org/debian-security bullseye-security main
|
|||
|
deb-src http://security.debian.org/debian-security bullseye-security main
|
|||
|
|
|||
|
deb http://deb.debian.org/debian/ bullseye-updates main
|
|||
|
deb-src http://deb.debian.org/debian/ bullseye-updates main
|
|||
|
```
|
|||
|
|
|||
|
以下是**更改后**的 `/etc/apt/sources.list` 文件。以下镜像网址是默认设置。如果你使用不同的 Debian 镜像,请不要更改它们:
|
|||
|
|
|||
|
```
|
|||
|
deb http://deb.debian.org/debian/ bookworm main
|
|||
|
deb-src http://deb.debian.org/debian/ bookworm main
|
|||
|
|
|||
|
deb http://security.debian.org/debian-security bookworm-security main
|
|||
|
deb-src http://security.debian.org/debian-security bookworm-security main
|
|||
|
|
|||
|
deb http://deb.debian.org/debian/ bookworm-updates main
|
|||
|
deb-src http://deb.debian.org/debian/ bookworm-updates main
|
|||
|
|
|||
|
deb http://deb.debian.org/debian bookworm non-free non-free-firmware
|
|||
|
deb-src http://deb.debian.org/debian bookworm non-free non-free-firmware
|
|||
|
|
|||
|
deb http://deb.debian.org/debian-security bookworm-security non-free non-free-firmware
|
|||
|
deb-src http://deb.debian.org/debian-security bookworm-security non-free non-free-firmware
|
|||
|
|
|||
|
deb http://deb.debian.org/debian bookworm-updates non-free non-free-firmware
|
|||
|
deb-src http://deb.debian.org/debian bookworm-updates non-free non-free-firmware
|
|||
|
```
|
|||
|
|
|||
|
![更新源文件][3]
|
|||
|
|
|||
|
**注意**:从 Debian 12 “Bookworm” 开始,Debian 团队创建了一个新的仓库 `non-free-firmware` 来打包非自由的软件包。因此,在上面的示例中最后三个部分中也包含了它们。
|
|||
|
|
|||
|
保存文件并退出。
|
|||
|
|
|||
|
打开终端并运行以下命令以开始升级过程:
|
|||
|
|
|||
|
```
|
|||
|
sudo apt update
|
|||
|
sudo apt full-upgrade
|
|||
|
```
|
|||
|
|
|||
|
![升级过程][4]
|
|||
|
|
|||
|
![Debian 12 升级过程进行中][5]
|
|||
|
|
|||
|
在升级过程中,安装程序可能会要求你重新启动几个服务。仔细阅读消息后点击 “Yes”。另外,如果你看到带有 `:` 的提示,请按 `q` 键退出该消息。
|
|||
|
|
|||
|
![确认服务验证][6]
|
|||
|
|
|||
|
等待软件包下载和安装完成。
|
|||
|
|
|||
|
升级完成后,请重新启动你的 Debian 桌面或服务器:
|
|||
|
|
|||
|
```
|
|||
|
sudo systemctl reboot
|
|||
|
```
|
|||
|
|
|||
|
### 检查升级状态
|
|||
|
|
|||
|
重启后,请验证你是否正在运行 Debian 12。可以使用以下文件检查 Debian 版本:
|
|||
|
|
|||
|
```
|
|||
|
cat /etc/debian_version
|
|||
|
```
|
|||
|
|
|||
|
示例输出:
|
|||
|
|
|||
|
![Debian 12 Bookworm Desktop (Xfce)][7]
|
|||
|
|
|||
|
此外,如果你刚刚升级到 Debian 12 服务器,请确保验证正在运行的服务,例如 HTTP、SSH 等。你可以使用以下 [systemd 命令][8] 了解正在运行的服务:
|
|||
|
|
|||
|
```
|
|||
|
systemctl list-units --type=service
|
|||
|
```
|
|||
|
|
|||
|
### 总结和清理
|
|||
|
|
|||
|
在确认所有步骤都已完成后,你可能希望运行 `apt autoremove` 命令来清理不需要的软件包。但是,请在执行此操作时格外小心。
|
|||
|
|
|||
|
```
|
|||
|
sudo apt --purge autoremove
|
|||
|
```
|
|||
|
|
|||
|
这就是升级到 Debian 12 的简要步骤。希望你的升级顺利进行。如果你正在关键服务器上运行 Debian 11,请勿立即升级,请等到 Debian 12.1 发布。
|
|||
|
|
|||
|
有关 Debian 升级的更多信息,请访问 [官方文档][9]。
|
|||
|
|
|||
|
最后,请别忘了告诉我们你的升级情况。
|
|||
|
|
|||
|
--------------------------------------------------------------------------------
|
|||
|
|
|||
|
via: https://www.debugpoint.com/upgrade-debian-12-from-debian-11/
|
|||
|
|
|||
|
作者:[Arindam][a]
|
|||
|
选题:[lkxed][b]
|
|||
|
译者:ChatGPT
|
|||
|
校对:[wxy](https://github.com/wxy)
|
|||
|
|
|||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
|||
|
|
|||
|
[a]: https://www.debugpoint.com/author/admin1/
|
|||
|
[b]: https://github.com/lkxed/
|
|||
|
[1]: https://linux.cn/article-15776-1.html
|
|||
|
[2]: https://wiki.debian.org/NetworkConfiguration
|
|||
|
[3]: https://www.debugpoint.com/wp-content/uploads/2023/06/updating-sources-file.jpg
|
|||
|
[4]: https://www.debugpoint.com/wp-content/uploads/2023/06/Upgrade-process-1.jpg
|
|||
|
[5]: https://www.debugpoint.com/wp-content/uploads/2023/06/Debian-12-Upgrade-process-in-progress.jpg
|
|||
|
[6]: https://www.debugpoint.com/wp-content/uploads/2023/06/Confirmation-about-service-verifications.jpg
|
|||
|
[7]: https://www.debugpoint.com/wp-content/uploads/2023/06/Debian-12-Bookworm-Desktop-Xfce.jpg
|
|||
|
[8]: https://www.debugpoint.com/systemd-systemctl-service/
|
|||
|
[9]: https://www.debian.org/releases/bookworm/amd64/release-notes/ch-upgrading.en.html
|
|||
|
[0]: https://img.linux.net.cn/data/attachment/album/202306/13/095427caykwtqw8fay944z.jpg
|