免责声明: 请注意,本指南仅用于测试目的,而非生产环境,因此,我们对本文所述过程可能对你的系统造成的任何损害不承担任何责任。
在运行系统升级到下一个主要版本之前,请确保备份当前系统。
运行系统更新
首先将Ubuntu 18.04系统软件包更新和升级到最新版本。
sudo apt update
sudo apt upgrade
你也可以运行系统完全升级。
sudo apt full-upgrade
根据 man 8 apt
full-upgrade
执行升级功能,但是如果需要将当前安装的软件包作为一个整体升级系统,则删除。
删除不再需要的软件包。
sudo apt autoremove
升级完成后重新引导系统。
sudo systemctl reboot
将Ubuntu 18.04升级到ubuntu 20.04
ubuntu附带了一个名为 do-release-upgrade
,用于将ubuntu操作系统升级到最新版本,默认情况下安装此实用程序,如果没有安装,出于某些原因,你可以简单地安装,update-manager-core
它通过运行;
sudo apt install update-manager-core
然后,只需执行,就可以将系统升级运行到新版本;,
do-release-upgrade
实用程序支持许多命令行选项。 确认一下 do-release-upgrade -h
,例如,如果你使用的是Ubuntu 18.04桌面版本,则可以通过运行,
sudo do-release-upgrade -m desktop
为服务器版本运行定期升级;
sudo do-release-upgrade -m server
do-release-upgrade
命令通常只在主要lts发行版的发行版发布后有效
如果你得到输出, There is no development version of an LTS available
那是因为 20.04.1 尚不可用。
这样,由于我们正在处理测试版本,因此你可以简单地将Ubuntu 18 04系统升级到Ubuntu 20 04的开发发行版,-d
或者 --devel-release
选项为 do-release-upgrade
命令。
sudo do-release-upgrade -m desktop -d
键入上面的命令并按Enter,将立即开始系统升级到Ubuntu 20 04的开发版本。
Checking for a new Ubuntu release
Get:1 Upgrade tool signature [1,554 B]
Get:2 Upgrade tool [1,335 kB]
Fetched 1,337 kB in 0s (0 B/s)
authenticate 'focal.tar.gz' against 'focal.tar.gz.gpg'
extracting 'focal.tar.gz'
Reading cache
Checking package manager
Reading package lists... Done
Building dependency tree
Reading state information... Done
Hit http://ke.archive.ubuntu.com/ubuntu bionic InRelease
Hit http://ke.archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit http://ke.archive.ubuntu.com/ubuntu bionic-backports InRelease
Get:1 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Fetched 88.7 kB in 0s (0 B/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
Checking for installed snaps
...
回答升级过程中出现的问题。
...
Do you want to start the upgrade?
36 installed packages are no longer supported by Canonical. You can
still get support from the community.
13 packages are going to be removed. 246 new packages are going to be
installed. 1256 packages are going to be upgraded.
You have to download a total of 810 M. This download will take about
11 minutes with your connection.
Installing the upgrade can take several hours. Once the download has
finished, the process cannot be canceled.
Continue [yN] Details [d] y
接受升级并按enter继续。
在升级过程中,你会注意到变化,例如,桌面版本的背景。
当提示删除过时的软件包时,接受并按enter继续。
...
Searching for obsolete software
Reading state information... Done
Remove obsolete packages?
86 packages are going to be removed.
Continue [yN] Details [d]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
你已经成功地将Ubuntu 18.04系统升级到ubuntu 20.04.