|2023-06-1309:55
以下是怎样从Debian11升级到Debian12“Bookworm”的步骤。
Debian12Bookworm早已发布。假如你正在运行Debian11“Bullseye”,你可以计划如今升级你的台式机或服务器。并且,建议你等待Debian“Bookworm”的第一个小版本,即12.1版本,再进行关键服务器升级。
话虽这么,假如你想了解Debian12的新特点,可以查看这篇文章。以下是详尽的升级步骤:
从Debian11升级到Debian12
无论你运行的是Debian服务器还是任何桌面版本,请确保备份关键数据。比如,你可能须要为桌面文档进行备份。若果是服务器,请记录正在运行的服务。你可以使用rsync或其他实用工具来完成此操作。
Debian12引入了一个名为non-free-firmware的新库房,用于专有驱动程序和软件包。假如你使用任何“闭源”的网路、显示、图形或其他驱动程序,你可能须要在升级后进行配置。
对于网路驱动程序,请确保在某个地方安全地记录/etc/network/interfaces和/etc/resolv.conf文件的内容。若果在升级完成后丧失了网路联接,可以根据这个手册轻松设置它。
从命令提示符运行以下命令,以确保Debian11更新了安全和其他软件包:
sudo apt update
sudo apt upgrade
sudo apt full-upgrade
sudo apt autoremove
完成上述命令后,重新启动Debian11系统:
sudo systemctl reboot
记下关于Debian11的几个信息。这对于服务器很重要。它们包括内核版本和Debian版本。这是由于升级后,你可以验证下边的相同命令以确保升级成功。
比如,我尝试升级的系统是Debian11.7linux命令 查看版本,内核版本为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文件,并将Debian12的代号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镜像linux删除命令,请不要修改它们:
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
注意:从Debian12“Bookworm”开始,Debian团队创建了一个新的库房non-free-firmware来打包非自由的软件包。为此,在里面的示例中最后三个部份中也包含了它们。
保存文件并退出。
打开终端并运行以下命令以开始升级过程:
sudo apt update
sudo apt full-upgrade
在升级过程中,安装程序可能会要求你重新启动几个服务。仔细阅读消息后点击“Yes”。另外,假如你看见带有:的提示linux命令 查看版本,请按q键退出该消息。
等待软件包下载和安装完成。
升级完成后LINUX虚机,请重新启动你的Debian桌面或服务器:
sudo systemctl reboot
检测升级状态
重启后,请验证你是否正在运行Debian12。可以使用以下文件检测Debian版本:
cat /etc/debian_version
示例输出:
据悉,假如你刚才升级到Debian12服务器,请确保验证正在运行的服务,比如HTTP、SSH等。你可以使用以下systemd命令了解正在运行的服务:
systemctl list-units --type=service
总结和清除
在确认所有步骤都已完成后,你可能希望运行aptautoremove命令来清理不须要的软件包。并且,请在执行此操作时愈发当心。
sudo apt --purge autoremove
这就是升级到Debian12的简略步骤。希望你的升级顺利进行。假如你正在关键服务器上运行Debian11,切勿立刻升级,请等到Debian12.1发布。
有关Debian升级的更多信息,请访问官方文档。
最后,请别忘了告诉我们你的升级情况。
via:
作者:Arindam选题:lkxed译者:ChatGPT校对:wxy
本文由LCTT原创编译,Linux中国荣誉推出