126
108

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Ubuntu 18.04(LTS)→20.04(LTS)アップグレード方法

Last updated at Posted at 2020-04-28

はじめに

2020年4月23日、Ubuntu 20.04がリリースされました。

Ubuntuは通例として、偶数年度の4月リリースは長期サポート版(LTS:Long Term Support)です。

サポート期間は5年間!(〜2025年4月まで)

前回のLTSである Ubuntu 18.04からアップグレードする方々もいらっしゃると思いますので、アップグレード手順のメモをここに残します。

Released
(Current & Stable)
Version Release Schedule Support Date
Xenial Xerus 16.04 LTS 2016/04/21 2021年4月まで
Bionic Beaver 18.04 LTS 2018/04/26 2023年4月まで
Focal Fossa 20.04 LTS 2020/04/23 2025年4月まで

前提条件

以下の条件を満たすVPS/オンプレサーバを保有している事を前提条件とします。

  • Ubuntu Server 18.04 LTS が動作している事。
  • インターネットに接続する経路を持つ事。
  • リモート環境からSSH接続が可能である事。

手順

  1. sudo apt updateを実行します。
ubuntu@ubuntu:~$ sudo apt update
[sudo] password for ubuntu: 
Get:1 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Hit:2 http://archive.ubuntu.com/ubuntu bionic InRelease                    
Get:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]      
Get:4 http://archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
Get:5 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages [915 kB]
Get:6 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages [1,065 kB]
Fetched 2,233 kB in 3s (639 kB/s)
Reading package lists... Done
Building dependency tree       
Reading state information... Done
25 packages can be upgraded. Run 'apt list --upgradable' to see them.
ubuntu@ubuntu:~$ 

2.sudo apt install update-managerを実行します。

ubuntu@ubuntu:~$ sudo apt install update-manager
Reading package lists... Done
Building dependency tree       
Reading state information... Done
(以降、省略)

3.sudo apt dist-upgradeを実行します。

ubuntu@ubuntu:~$ sudo apt dist-upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages were automatically installed and are no longer required:
  linux-headers-4.15.0-60 linux-headers-4.15.0-60-generic
  linux-image-4.15.0-60-generic linux-modules-4.15.0-60-generic
  linux-modules-extra-4.15.0-60-generic
Use 'sudo apt autoremove' to remove them.
The following packages will be upgraded:
  bsdutils distro-info-data fdisk grub-common grub-pc grub-pc-bin grub2-common
  kmod landscape-common libblkid1 libfdisk1 libkmod2 libmount1 libsmartcols1
  libuuid1 linux-firmware lxcfs mount open-vm-tools python3-update-manager
  sosreport unattended-upgrades update-manager-core util-linux uuid-runtime
25 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 81.2 MB of archives.
After this operation, 739 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
(以降、省略)

本コマンドを実行せずに次のステップに進んだ場合は、以下のエラーが表示され、操作が中断されます。

ubuntu@ubuntu:~$ sudo do-release-upgrade -d
Checking for a new Ubuntu release
Please install all available updates for your release before upgrading.
ubuntu@ubuntu:~$ 

4.sudo do-release-upgrade -dを実行します。「-d」オプションは必須です。

※ LTSからLTSへのアップグレードする場合は/etc/update-manager/release-upgradesを編集する必要はありません。

ubuntu@ubuntu:~$ 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 0s (0 B/s)                                                 
authenticate 'focal.tar.gz' against 'focal.tar.gz.gpg' 
extracting 'focal.tar.gz'

5.この画面でyを入力します。デフォルト値はNなので、必ず入力してください。

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

6.Enterを押します。

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]

7.upgrade開始の確認が表示されるので、yを入力します。デフォルト値はNなので、必ず入力してください。

Do you want to start the upgrade? 


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

7 packages are going to be removed. 141 new packages are going to be 
installed. 496 packages are going to be upgraded. 

You have to download a total of 354 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. 

 Continue [yN]  Details [d] y

8.しばらくすると、下記画面が表示されます。Enterを押します。
001.png

9.しばらくすると、下記画面が表示されます。Enterを押します。
002.png

10.しばらくすると、下記画面が表示されます。Enterを押します。
003.png

11.Enterを押します。

Configuration file '/etc/cloud/cloud.cfg'
 ==> 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.
*** cloud.cfg (Y/I/N/O/D/Z) [default=N] ? 

12.古いパッケージ一覧が表示されるので、yを入力して削除します。デフォルト値はNなので、必ず入力してください。

Found linux image: /boot/vmlinuz-4.15.0-88-generic
Found initrd image: /boot/initrd.img-4.15.0-88-generic
Found linux image: /boot/vmlinuz-4.15.0-60-generic
Found initrd image: /boot/initrd.img-4.15.0-60-generic
done
Processing triggers for dbus (1.12.16-2ubuntu2) ...
Reading package lists... Done    
Building dependency tree          
Reading state information... Done

Searching for obsolete software
Reading state information... Done

Remove obsolete packages? 


61 packages are going to be removed. 

 Continue [yN]  Details [d] y

13.アップグレードを完了させる為にyを入力して再起動します。デフォルト値はNなので、必ず入力してください。

Purging configuration files for linux-image-4.15.0-60-generic (4.15.0-60.67) ...
Purging configuration files for python3.6-minimal (3.6.9-1~18.04ubuntu1) ...

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

14.ubuntuが再起動されます。

15.SSHにて、再接続します。

16.more /etc/os-releaseを実行して、Ubuntuのバージョンを確認します。

ubuntu@ubuntu:~$ more /etc/os-release 
NAME="Ubuntu"
VERSION="20.04 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-poli
cy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
ubuntu@ubuntu:~$ 

17.以上でアップグレードは完了です、お疲れ様でした。

desktopインストール&RDP設定は、こちら。

参考資料

ubuntu wiki
https://wiki.ubuntu.com/

126
108
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
126
108

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?