更新 Ubuntu 到最新的 LTS 版本

Apr 26, 2020 • 预计阅读时间 2 分钟

Ubuntu 20.04 已经发布几天了,我购买的阿里云官方镜像还是只有 18.04 版本。

首先需要更新所有软件包到最新到版本:

sudo apt-get update -y && sudo apt-get upgrade -y

然后开始升级:

sudo do-release-upgrade -d

Checking for a new Ubuntu release
Get:1 Upgrade tool signature [1,554 B]                                         
Get:2 Upgrade tool [1,344 kB]                                                  
Fetched 1,346 kB in 6s (157 kB/s)                                              
authenticate 'focal.tar.gz' against 'focal.tar.gz.gpg' 
extracting 'focal.tar.gz'

Reading cache

Checking package manager

Continue running under SSH? 

This session appears to be running under ssh. It is not recommended 
to perform a upgrade over ssh currently because in case of failure it 
is harder to recover. 

If you continue, an additional ssh daemon will be started at port 
'1022'. 
Do you want to continue? 

Continue [yN]

输入 y

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]

按回车继续升级:

Reading package lists... Done
Building dependency tree        
Reading state information... Done
Hit http://cn.archive.ubuntu.com/ubuntu bionic InRelease                       
Hit http://cn.archive.ubuntu.com/ubuntu bionic-updates InRelease               
Hit http://cn.archive.ubuntu.com/ubuntu bionic-backports InRelease             
Hit http://cn.archive.ubuntu.com/ubuntu bionic-security InRelease              
Fetched 0 B in 0s (0 B/s)                                                      
Reading package lists... Done    
Building dependency tree          
Reading state information... Done

Updating repository information
Get:1 http://cn.archive.ubuntu.com/ubuntu focal InRelease [265 kB]             
Get:2 http://cn.archive.ubuntu.com/ubuntu focal-updates InRelease [89.1 kB]    
Get:3 http://cn.archive.ubuntu.com/ubuntu focal-backports InRelease [89.2 kB]  
Get:4 http://cn.archive.ubuntu.com/ubuntu focal-security InRelease [97.9 kB]   
Get:5 http://cn.archive.ubuntu.com/ubuntu focal/main amd64 Packages [970 kB]   
Get:6 http://cn.archive.ubuntu.com/ubuntu focal/main i386 Packages [718 kB]    
Get:7 http://cn.archive.ubuntu.com/ubuntu focal/main Translation-en [506 kB]   
Get:8 http://cn.archive.ubuntu.com/ubuntu focal/main amd64 c-n-f Metadata [29.5 kB]
Get:9 http://cn.archive.ubuntu.com/ubuntu focal/restricted amd64 Packages [22.0 kB]
Get:10 http://cn.archive.ubuntu.com/ubuntu focal/restricted i386 Packages [8,112 B]
Get:11 http://cn.archive.ubuntu.com/ubuntu focal/restricted Translation-en [6,212 B]
Get:12 http://cn.archive.ubuntu.com/ubuntu focal/restricted amd64 c-n-f Metadata [392 B]
Get:13 http://cn.archive.ubuntu.com/ubuntu focal/universe amd64 Packages [8,628 kB]
Get:14 http://cn.archive.ubuntu.com/ubuntu focal/universe i386 Packages [4,642 kB]
Get:15 http://cn.archive.ubuntu.com/ubuntu focal/universe Translation-en [5,124 kB]
Get:16 http://cn.archive.ubuntu.com/ubuntu focal/universe amd64 c-n-f Metadata [265 kB]
Get:17 http://cn.archive.ubuntu.com/ubuntu focal/universe amd64 c-n-f Metadata [265 kB]
Get:18 http://cn.archive.ubuntu.com/ubuntu focal/multiverse amd64 Packages [144 kB]
Get:19 http://cn.archive.ubuntu.com/ubuntu focal/multiverse i386 Packages [74.7 kB]
Get:20 http://cn.archive.ubuntu.com/ubuntu focal/multiverse Translation-en [104 kB]
Get:21 http://cn.archive.ubuntu.com/ubuntu focal/multiverse amd64 c-n-f Metadata [9,136 B]
Get:22 http://cn.archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [2,000 B]
Get:23 http://cn.archive.ubuntu.com/ubuntu focal-updates/main i386 Packages [648 B]
Get:24 http://cn.archive.ubuntu.com/ubuntu focal-updates/main Translation-en [1,152 B]
Get:25 http://cn.archive.ubuntu.com/ubuntu focal-updates/main amd64 c-n-f Metadata [160 B]
Get:26 http://cn.archive.ubuntu.com/ubuntu focal-updates/restricted amd64 c-n-f Metadata [116 B]
Get:27 http://cn.archive.ubuntu.com/ubuntu focal-updates/universe amd64 c-n-f Metadata [112 B]
Get:28 http://cn.archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 c-n-f Metadata [116 B]
Get:29 http://cn.archive.ubuntu.com/ubuntu focal-backports/main amd64 c-n-f Metadata [112 B]
Get:30 http://cn.archive.ubuntu.com/ubuntu focal-backports/restricted amd64 c-n-f Metadata [116 B]
Get:31 http://cn.archive.ubuntu.com/ubuntu focal-backports/universe amd64 c-n-f Metadata [116 B]
Get:32 http://cn.archive.ubuntu.com/ubuntu focal-backports/multiverse amd64 c-n-f Metadata [116 B]
Get:33 http://cn.archive.ubuntu.com/ubuntu focal-security/main amd64 c-n-f Metadata [108 B]
Get:34 http://cn.archive.ubuntu.com/ubuntu focal-security/restricted amd64 c-n-f Metadata [116 B]
Get:35 http://cn.archive.ubuntu.com/ubuntu focal-security/universe amd64 c-n-f Metadata [112 B]
Get:36 http://cn.archive.ubuntu.com/ubuntu focal-security/multiverse amd64 c-n-f Metadata [116 B]
Fetched 21.8 MB in 6s (65.2 kB/s)                                              

Checking package manager
Reading package lists... Done    
Building dependency tree          
Reading state information... Done

Calculating the changes

Calculating the changes
No candidate ver:  linux-image-4.15.0-55-generic
No candidate ver:  linux-modules-4.15.0-55-generic
No candidate ver:  linux-modules-extra-4.15.0-55-generic

Do you want to start the upgrade? 


7 installed packages are no longer supported by Canonical. You can 
still get support from the community. 

7 packages are going to be removed. 103 new packages are going to be 
installed. 495 packages are going to be upgraded. 

You have to download a total of 475 M. This download will take about 
36 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,接下来就是漫长的安装过程。


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

查看一下升级后的系统版本:

lsb_release -a

LSB Version:	core-11.1.0ubuntu2-noarch:security-11.1.0ubuntu2-noarch
Distributor ID:	Ubuntu
Description:	Ubuntu 20.04 LTS
Release:	20.04
Codename:	focal
Ubuntu
版权声明:如果转发请带上本文链接和注明来源。

lvv.me

iOS/macOS Developer

从 LetsEncrypt 获取免费的泛域名 SSL 证书

Nginx 重定向 HTTP 请求到 HTTPS 端口