如何从Ubuntu 16.04升级到18.04

2023年 7月 21日 25.4k 0

最新的Ubuntu LTS版本Ubuntu 18.04(Bionic Beaver)于2018年4月26日发布,支持5年,直到2023年4月。在本教程中,我们将向您展示如何升级Ubuntu 16.04。安装或更高版本安装到Ubuntu 18.04(Bionic Beaver)

先决条件

开始学习本教程之前,请确保您以位具有sudo特权的用户身份登录。

备份您的数据

首先,请确保在开始操作系统的重大升级之前先备份数据。如果您是在虚拟机上运行Ubuntu,则最好进行完整的系统快照,以便在更新延后的情况下轻松恢复计算机。

更新当前安装的软件包

在开始发行版本升级之前,建议将所有当前安装的软件包更新为最新版本。

sudo apt update sudo apt upgrade

我们还将运行dist-upgrade,它将对已安装的软件包进行主要版本升级,并可能删除一些不必要的软件包:

sudo apt dist-upgrade

将Ubuntu 16.04升级到Ubuntu 18.04

Ubuntu提供了一个名为do-release-upgrade的工具,该工具使升级过程变得非常简单。该工具应该已经安装在您的系统上,但是如果由于某种原因未安装,则可以使用以下命令进行安装:

sudo apt install do-release-upgrade

开始升级运行do-release-upgrade

sudo do-release-upgrade

如果您要像我一样通过SSH升级系统,则会询问您是否要继续。

Reading cache Checking package manager Continue running under SSH? This session appears to be running under ssh. It is not recommendedto perform an upgrade over ssh currently because in case of failure itis harder to recover. If you continue, an additional ssh daemon will be started at port'1022'.Do you want to continue? Continue [yN]
Starting additional sshd  To make recovery in case of failure easier, an additional sshd will be started on port '1022'. If anything goes wrong with the running ssh you can still connect to the additional one. If you run a firewall, you may need to temporarily open this port. As this is potentially dangerous it's not done automatically. You can open the port with e.g.: 'iptables -I INPUT -p tcp --dport 1022 -j ACCEPT'  To continue please press [ENTER]

一旦升级工具下载了软件包列表并计算了更改,它将询问您是否要继续。

Do you want to start the upgrade?  
4 installed packages are no longer supported by Canonical. You can still get support from the community.  
3 packages are going to be removed. 90 new packages are going to be installed. 397 packages are going to be upgraded.  You have to download a total of 267 M. This download will take about 
1 minute with your connection.  Installing the upgrade can take several hours. Once the download has finished, the process cannot be canceled.

再次输入y,升级过程将开始。

在升级过程中,系统会询问您各种问题,例如您要保留现有的配置文件还是要安装软件包维护者的版本。如果您未对文件进行任何自定义更改,则可以安全地键入Y,否则要保持当前配置,请输入N


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.*** sysctl.conf (Y/I/N/O/D/Z) [default=N] ?

升级过程可能需要一些时间,具体取决于更新的数量和您的互联网速度。

一旦安装了新软件包,更新工具将询问您是否要删除过时的软件,如果不确定是否键入d并检查过时的软件包列表,在大多数情况下,可以安全地输入y并删除所有过时的软件包:


Searching for obsolete softwareReading package lists... DoneBuilding dependency treeReading state information... DoneReading state information... Done Remove obsolete packages?  17 packages are going to be removed.

升级过程完成并假设一切顺利后,系统会要求您重新启动计算机。输入y继续:

System upgrade is complete.  Restart required  To finish the upgrade, a restart is required. If you select 'y' the system will be restarted.  Continue [yN] y

确认更新

等待片刻,直到服务器重新启动,然后重新连接。登录后,您会收到以下消息:

Welcome to Ubuntu 18.04 LTS (GNU/Linux 4.15.0-20-generic x86_64)

您也可以使用以下命令检查Ubuntu版本:

lsb_release -aNo LSB modules are available. Distributor ID: Ubuntu Description:    Ubuntu 18.04 LTS Release:    18.04 Codename:   bionic

就是这样,您现在可以使用新的Ubuntu 18.04 LTS。

相关文章

服务器端口转发,带你了解服务器端口转发
服务器开放端口,服务器开放端口的步骤
产品推荐:7月受欢迎AI容器镜像来了,有Qwen系列大模型镜像
如何使用 WinGet 下载 Microsoft Store 应用
百度搜索:蓝易云 – 熟悉ubuntu apt-get命令详解
百度搜索:蓝易云 – 域名解析成功但ping不通解决方案

发布评论