ubuntu lts をアップグレードする方法

2023.8.23

はじめに

今回は、ubuntu ltsのバージョンを20.04.6 LTS (Focal Fossa)から22.04.3 LTS (Jammy Jellyfish)にアップグレードします。
環境はWindows10のWSL2です。

現在のバージョンを確認

/etc/os-releaseを見れば現在のバージョン情報がわかります。

$ cat /etc/os-release

NAME="Ubuntu"
VERSION="20.04.6 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.6 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-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal

パッケージのアップデート

$ sudo apt update && sudo apt upgrade

アップグレードに必要なパッケージのインストール

$ sudo apt dist-upgrade && sudo apt install update-manager-core

アップグレードマネージャの設定

最終行がPrompt=ltsになっていることを確認。

$ sudo cat /etc/update-manager/release-upgrades

# Default behavior for the release upgrader.

[DEFAULT]
# Default prompting and upgrade 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

アップグレードの実行

$ sudo do-release-upgrade -d

何度か確認のプロンプトが出るので[y]をタイプしていく。

完了確認

新しいバージョンに変わっていれば成功です。

$ cat /etc/os-release

PRETTY_NAME="Ubuntu 22.04.3 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.3 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
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-policy"

おすすめ

関連記事