Ubuntu Server 20.04.2の初期設定 OSアップデート編

スポンサーリンク

Ubuntuをインストールして時刻合わせをして安心していてはいけません。
OSのアップデートを行いましょう。

最新の状態にしておくことはセキュリティの面からも非常に大切。
※もし導入予定のアプリなどがある場合は、影響を調査してからにしましょうね。

スポンサーリンク

ローカルパッケージインデックスの更新

使うコマンドは sudo apt update
アップデート可能なパッケージ数が表示されます。

user01@ubuntuserver01:~$ sudo apt update
Hit:1 http://jp.archive.ubuntu.com/ubuntu focal InRelease
Get:2 http://jp.archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Get:3 http://jp.archive.ubuntu.com/ubuntu focal-backports InRelease [101 kB]
Get:4 http://jp.archive.ubuntu.com/ubuntu focal-security InRelease [109 kB]
Get:5 http://jp.archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [890 kB]
Get:6 http://jp.archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [755 kB]
Fetched 1,968 kB in 2s (1,019 kB/s)
Reading package lists… Done
Building dependency tree
Reading state information… Done
37 packages can be upgraded. Run 'apt list –upgradable’ to see them.
user01@ubuntuserver01:~$

 

Ubuntuのアップデート状況の確認

使用コマンドは
sudo apt list –upgradable

user01@ubuntuserver01:~$ sudo apt list –upgradable
Listing… Done
bind9-dnsutils/focal-updates 1:9.16.1-0ubuntu2.7 amd64 [upgradable from: 1:9.16.1-0ubuntu2.6]
bind9-host/focal-updates 1:9.16.1-0ubuntu2.7 amd64 [upgradable from: 1:9.16.1-0ubuntu2.6]
bind9-libs/focal-updates 1:9.16.1-0ubuntu2.7 amd64 [upgradable from: 1:9.16.1-0ubuntu2.6]
dirmngr/focal-updates 2.2.19-3ubuntu2.1 amd64 [upgradable from: 2.2.19-3ubuntu2]
friendly-recovery/focal-updates 0.2.41ubuntu0.20.04.1 all [upgradable from: 0.2.41]
gnupg-l10n/focal-updates 2.2.19-3ubuntu2.1 all [upgradable from: 2.2.19-3ubuntu2]
gnupg-utils/focal-updates 2.2.19-3ubuntu2.1 amd64 [upgradable from: 2.2.19-3ubuntu2]
gnupg/focal-updates 2.2.19-3ubuntu2.1 all [upgradable from: 2.2.19-3ubuntu2]
gpg-agent/focal-updates 2.2.19-3ubuntu2.1 amd64 [upgradable from: 2.2.19-3ubuntu2]
gpg-wks-client/focal-updates 2.2.19-3ubuntu2.1 amd64 [upgradable from: 2.2.19-3ubuntu2]
gpg-wks-server/focal-updates 2.2.19-3ubuntu2.1 amd64 [upgradable from: 2.2.19-3ubuntu2]
gpg/focal-updates 2.2.19-3ubuntu2.1 amd64 [upgradable from: 2.2.19-3ubuntu2]
gpgconf/focal-updates 2.2.19-3ubuntu2.1 amd64 [upgradable from: 2.2.19-3ubuntu2]
gpgsm/focal-updates 2.2.19-3ubuntu2.1 amd64 [upgradable from: 2.2.19-3ubuntu2]
gpgv/focal-updates 2.2.19-3ubuntu2.1 amd64 [upgradable from: 2.2.19-3ubuntu2]
initramfs-tools-bin/focal-updates 0.136ubuntu6.4 amd64 [upgradable from: 0.136ubuntu6.3]
initramfs-tools-core/focal-updates 0.136ubuntu6.4 all [upgradable from: 0.136ubuntu6.3]
initramfs-tools/focal-updates 0.136ubuntu6.4 all [upgradable from: 0.136ubuntu6.3]
isc-dhcp-client/focal-updates 4.4.1-2.1ubuntu5.20.04.1 amd64 [upgradable from: 4.4.1-2.1ubuntu5]
isc-dhcp-common/focal-updates 4.4.1-2.1ubuntu5.20.04.1 amd64 [upgradable from: 4.4.1-2.1ubuntu5]
libnss-systemd/focal-updates 245.4-4ubuntu3.5 amd64 [upgradable from: 245.4-4ubuntu3.4]
libpam-systemd/focal-updates 245.4-4ubuntu3.5 amd64 [upgradable from: 245.4-4ubuntu3.4]
libsystemd0/focal-updates 245.4-4ubuntu3.5 amd64 [upgradable from: 245.4-4ubuntu3.4]
libudev1/focal-updates 245.4-4ubuntu3.5 amd64 [upgradable from: 245.4-4ubuntu3.4]
open-vm-tools/focal-updates 2:11.1.5-1~ubuntu20.04.2 amd64 [upgradable from: 2:11.0.5-4]
pollinate/focal-updates 4.33-3ubuntu1.20.04.1 all [upgradable from: 4.33-3ubuntu1]
python3-software-properties/focal-updates 0.98.9.4 all [upgradable from: 0.98.9.3]
python3-twisted-bin/focal-updates 18.9.0-11ubuntu0.20.04.1 amd64 [upgradable from: 18.9.0-11]
python3-twisted/focal-updates 18.9.0-11ubuntu0.20.04.1 all [upgradable from: 18.9.0-11]
python3-update-manager/focal-updates 1:20.04.10.6 all [upgradable from: 1:20.04.10.5]
software-properties-common/focal-updates 0.98.9.4 all [upgradable from: 0.98.9.3]
systemd-sysv/focal-updates 245.4-4ubuntu3.5 amd64 [upgradable from: 245.4-4ubuntu3.4]
systemd-timesyncd/focal-updates 245.4-4ubuntu3.5 amd64 [upgradable from: 245.4-4ubuntu3.4]
systemd/focal-updates 245.4-4ubuntu3.5 amd64 [upgradable from: 245.4-4ubuntu3.4]
udev/focal-updates 245.4-4ubuntu3.5 amd64 [upgradable from: 245.4-4ubuntu3.4]
update-manager-core/focal-updates 1:20.04.10.6 all [upgradable from: 1:20.04.10.5]
update-notifier-common/focal-updates 3.192.30.6 all [upgradable from: 3.192.30.5]
user01@ubuntuserver01:~$

 

Ubuntuのアップデート実施

使用コマンドは sudo apt upgrade


user01@ubuntuserver01:~$ sudo apt upgrade
Reading package lists… Done
Building dependency tree
Reading state information… Done
Calculating upgrade… Done
The following packages will be upgraded:
bind9-dnsutils bind9-host bind9-libs dirmngr friendly-recovery gnupg
gnupg-l10n gnupg-utils gpg gpg-agent gpg-wks-client gpg-wks-server gpgconf
gpgsm gpgv initramfs-tools initramfs-tools-bin initramfs-tools-core
isc-dhcp-client isc-dhcp-common libnss-systemd libpam-systemd libsystemd0
libudev1 open-vm-tools pollinate python3-software-properties python3-twisted
python3-twisted-bin python3-update-manager software-properties-common
systemd systemd-sysv systemd-timesyncd udev update-manager-core
update-notifier-common
37 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 12.8 MB of archives.
After this operation, 131 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://jp.archive.ubuntu.com/ubuntu focal-updates/main amd64 libnss-systemd amd64 245.4-4ubuntu3.5 [95.8 kB]
Get:2 http://jp.archive.ubuntu.com/ubuntu focal-updates/main amd64 udev amd64 245.4-4ubuntu3.5 [1,366 kB]
Get:3 http://jp.archive.ubuntu.com/ubuntu focal-updates/main amd64 libudev1 amd64 245.4-4ubuntu3.5 [81.2 kB]
Get:4 http://jp.archive.ubuntu.com/ubuntu focal-updates/main amd64 systemd-sysv amd64 245.4-4ubuntu3.5 [10.3 kB]
~~~~~中略~~~~~Setting up gpg-wks-client (2.2.19-3ubuntu2.1) …
Setting up update-notifier-common (3.192.30.6) …
Setting up software-properties-common (0.98.9.4) …
Setting up gnupg (2.2.19-3ubuntu2.1) …
Setting up systemd (245.4-4ubuntu3.5) …
Setting up systemd-timesyncd (245.4-4ubuntu3.5) …
Setting up systemd-sysv (245.4-4ubuntu3.5) …
Setting up libnss-systemd:amd64 (245.4-4ubuntu3.5) …
Setting up friendly-recovery (0.2.41ubuntu0.20.04.1) …
Sourcing file `/etc/default/grub’
Sourcing file `/etc/default/grub.d/init-select.cfg’
Generating grub configuration file …
Found linux image: /boot/vmlinuz-5.4.0-70-generic
Found initrd image: /boot/initrd.img-5.4.0-70-generic
done
Setting up libpam-systemd:amd64 (245.4-4ubuntu3.5) …
Processing triggers for install-info (6.7.0.dfsg.2-5) …
Processing triggers for libc-bin (2.31-0ubuntu9.2) …
Processing triggers for man-db (2.9.1-1) …
Processing triggers for dbus (1.12.16-2ubuntu2.1) …
Processing triggers for initramfs-tools (0.136ubuntu6.4) …
update-initramfs: Generating /boot/initrd.img-5.4.0-70-generic
user01@ubuntuserver01:~$

これでアップデート完了です。
所用時間はNW環境に依存しますが、自分が実施した時は3分弱でした。