This article uses the "Attribution 4.0 International (CC BY 4.0)" license agreement, welcome to reprint, or re-modify the use, but need to indicate the source. Signed 4.0 International (CC BY 4.0)
This article will introduce how to upgrade the server version of Ubuntu 18.04 LTS to the latest Ubuntu 20.04 LTS at the current point in time, as well as some details of the upgrade process, hoping to help Ubuntu who are eager to try.
Data backup and other operations need to be handled by yourself. In addition, to ensure the stability of the network, it is recommended to operate on the server springboard, which is more secure.
Currently this content has been run in the Ubuntu 20.04 LTS system environment, :)
First use apt update
to see what can be updated.
apt update
Hit:1 http://mirrors.aliyun.com/ubuntu bionic InReleaseGet:2 http://mirrors.aliyun.com/ubuntu bionic-updates InRelease [88.7 kB]Get:3 http://mirrors.aliyun.com/ubuntu bionic-security InRelease [88.7 kB]Get:4 http://mirrors.aliyun.com/ubuntu bionic-updates/universe Sources [281 kB]Get:5 http://mirrors.aliyun.com/ubuntu bionic-updates/main Sources [315 kB]Get:6 http://mirrors.aliyun.com/ubuntu bionic-updates/main amd64 Packages [915 kB]Get:7 http://mirrors.aliyun.com/ubuntu bionic-updates/main i386 Packages [669 kB]Get:8 http://mirrors.aliyun.com/ubuntu bionic-updates/main Translation-en [315 kB]Get:9 http://mirrors.aliyun.com/ubuntu bionic-updates/universe i386 Packages [1,014 kB]Get:10 http://mirrors.aliyun.com/ubuntu bionic-updates/universe amd64 Packages [1,065 kB]Get:11 http://mirrors.aliyun.com/ubuntu bionic-updates/universe Translation-en [331 kB]Hit:12 https://download.docker.com/linux/ubuntu bionic InReleaseGet:13 http://mirrors.aliyun.com/ubuntu bionic-security/universe Sources [168 kB]Get:14 http://mirrors.aliyun.com/ubuntu bionic-security/main Sources [146 kB]Get:15 http://mirrors.aliyun.com/ubuntu bionic-security/main amd64 Packages [692 kB]Get:16 http://mirrors.aliyun.com/ubuntu bionic-security/main i386 Packages [459 kB]Get:17 http://mirrors.aliyun.com/ubuntu bionic-security/universe amd64 Packages [657 kB]Get:18 http://mirrors.aliyun.com/ubuntu bionic-security/universe i386 Packages [618 kB]Fetched 7,823 kB in 3s (3,106 kB/s) Reading package lists... DoneBuilding dependency treeReading state information... Done19 packages can be upgraded. Run 'apt list --upgradable' to see them.
Then execute apt upgrade-y
and wait patiently for the software upgrade to complete. If you have updated recently, you will get a prompt similar to the following.
apt update
Reading package lists... Done Building dependency treeReading state information... DoneAll packages are up to date.
If you think the software source is slow during the upgrade process, you can try to replace the source, such as the following operation.
sed -i -e "s/mirrors.cloud.aliyuncs.com/mirrors.tuna.tsinghua.edu.cn/" /etc/apt/sources.list
When we execute do-release-upgrade
to try to upgrade, there may be three situations that tell us that we cannot upgrade.
When you finish executing the command, you may get the prompt "Please install all available updates for your release before upgrading", which means that you haven't actually upgraded all the software.
do-release-upgrade
Checking for a new Ubuntu releasePlease install all available updates for your release before upgrading.
You may be curious, I have obviously executed update
and upgrade
, why does this happen?
There is a big possibility here that if you have used apt-mark to lock some software versions, you need to perform an unlock operation first, such as:
apt-mark unhold docker-ce
As for how to see the software that needs to be upgraded or unlocked?
You can use the apt update&&apt list--upgradable
command to query:
apt list --upgradable
... Reading package lists... DoneBuilding dependency treeReading state information... Done1 package can be upgraded. Run 'apt list --upgradable' to see it.
...
Listing... Donedocker-ce/bionic 5:19.03.8~3-0~ubuntu-bionic amd64 [upgradable from: 5:19.03.6~3-0~ubuntu-bionic]N: There are 23 additional versions. Please use the '-a' switch to see them.
Then execute apt upgrade-y
again to complete all software upgrades.
But don't be happy too early, because you may still encounter the next thing.
When all the software is ready to be upgraded, continue to use do-release-upgrade
to upgrade the software, and you will see a prompt similar to the following.
do-release-upgrade
Checking for a new Ubuntu releaseThere is no development version of an LTS available.To upgrade to the latest non-LTS develoment releaseset Prompt=normal in /etc/update-manager/release-upgrades.
Here, because the official website has not officially opened the version push, if you want to get the version update, you need to add the command line parameter -d
to do-release-upgrade
to allow you to get the latest upgrade package.
Usage: do-release-upgrade [options]
Options:
- d, --devel-release If using the latest supported release, upgrade to the development release
If you are an Ubuntu 18.04 LTS user, we need to make a decision at this moment, whether to upgrade one version by one version, or to upgrade directly across versions. If you are a user of Ubuntu 19.10, it is much simpler, because there is no cross-version issue involved The latter part of the version can be upgraded.
We talk about the two upgrade methods in detail.
There is a well-known saying called "You can't take too much steps", and it can also be used for software upgrades in some cases.
Open the /etc/update-manager/release-upgrades
file, we can see the file description:
[ DEFAULT]# Default prompting behavior, valid options:## never - Never check for, or allow upgrading to, a new release.# normal - Check to see if a new release is available. If more than one new# release is found, the release upgrader will attempt to upgrade to# the supported release that immediately succeeds the# currently-running release.# lts - Check to see if a new LTS release is available. The upgrader# will attempt to upgrade to the first LTS release available after# the currently-running one. Note that if this option is used and# the currently-running release is not itself an LTS release the# upgrader will assume prompt was meant to be normal.Prompt=lts
Modify Prompt=lts
to Prompt=normal
, and then execute do-release-upgrade-d
, the first stage of upgrade will start:
do-release-upgrade -d
Checking for a new Ubuntu releaseGet:1 Upgrade tool signature [1,554 B] Get:2 Upgrade tool [1,329 kB] Fetched 1,331 kB in 0s (0 B/s) authenticate 'eoan.tar.gz' against 'eoan.tar.gz.gpg' extracting 'eoan.tar.gz'
Reading cache...
According to the actual situation, after we "Next all the way", when we are about to complete the upgrade, we will see the following prompt content:
。。。System upgrade is complete.
Restart required
To finish the upgrade, a restart is required. If you select 'y' the system will be restarted.
After the system restarts, log in to the system and you will see that the system has been successfully upgraded to Ubuntu 19.10:
Welcome to Ubuntu 19.10 (GNU/Linux 5.3.0-46-generic x86_64)
* Documentation: https://help.ubuntu.com * Management: https://landscape.canonical.com * Support: https://ubuntu.com/advantage
* Ubuntu 20.04 LTS is out, raising the bar on performance, security, and optimisation for Intel, AMD, Nvidia, ARM64 and Z15 as well as AWS, Azure and Google Cloud.
https://ubuntu.com/blog/ubuntu-20-04-lts-arrives
We modify the value in the /etc/update-manager/release-upgrades
file to Prompt=lts
, and execute do-release-upgrade-d
again to start the second stage of the upgrade. The operation process and the above There is no difference. After a cup of water, the server restarts again, and the upgrade of Ubuntu 20.04 LTS is complete.
Welcome to Ubuntu 20.04 LTS (GNU/Linux 5.4.0-26-generic x86_64)
* Documentation: https://help.ubuntu.com * Management: https://landscape.canonical.com * Support: https://ubuntu.com/advantage
* Ubuntu 20.04 LTS is out, raising the bar on performance, security, and optimisation for Intel, AMD, Nvidia, ARM64 and Z15 as well as AWS, Azure and Google Cloud.
https://ubuntu.com/blog/ubuntu-20-04-lts-arrives
After verifying the version-by-version upgrade, we will try a one-step cross-version upgrade.
A cross-version upgrade is equivalent to a "lazy version" of a version-by-version upgrade. Of course, laziness must be extreme. You can also use the command apt full-upgrade-y
to upgrade the software package.
Unlike the version-by-version upgrade, we no longer need to modify the release-upgrades
configuration file, just confirm whether the value of the /etc/update-manager/release-upgrades
file is set to lts
before upgrading .
After confirming that the value is correct, execute do-release-upgrade-d
and select the upgrade configuration according to your needs. After "All the way Next", the upgrade of Ubuntu 20.04 is complete.
Just one year after upgrading all machines to 18.04, the arrival of Ubuntu 20.04 LTS is a pleasant surprise.
Under normal circumstances, we use the combination of update
, upgrade
, do-release-upgrade
to complete the upgrade smoothly, but at the current point in time, the official website has not yet fully officially provided the release upgrade plan, so there is This article.
Well, there is another reason that contributed to this article. After returning home, I went to bed and forgot to feed the cat, and was woken up by the Mao child protesting...
Recommended Posts