AlmaLinuxのアップデート

AlmaLinuxのバージョンをアップデートしてみましょう。
今回は`9.0`から`9.4`アップデートを行います。

## 環境
```bash
cat /etc/os-release
```
```bash
NAME="AlmaLinux"
VERSION="9.0 (Emerald Puma)"
ID="almalinux"
ID_LIKE="rhel centos fedora"
VERSION_ID="9.0"
PLATFORM_ID="platform:el9"
PRETTY_NAME="AlmaLinux 9.0 (Emerald Puma)"
ANSI_COLOR="0;34"
LOGO="fedora-logo-icon"
CPE_NAME="cpe:/o:almalinux:almalinux:9::baseos"
HOME_URL="https://almalinux.org/"
DOCUMENTATION_URL="https://wiki.almalinux.org/"
BUG_REPORT_URL="https://bugs.almalinux.org/"

ALMALINUX_MANTISBT_PROJECT="AlmaLinux-9"
ALMALINUX_MANTISBT_PROJECT_VERSION="9.0"
REDHAT_SUPPORT_PRODUCT="AlmaLinux"
REDHAT_SUPPORT_PRODUCT_VERSION="9.0"
```

# 最新版へのアップデート

AlmaLinuxをアップデートするには`dnf upgrade`または`dnf update`を実行します。

が、まずは`dnf check-upgrade`でアップデートがあるかどうかを確認してみましょう。

```bash
dnf check-update
```
```bash
Last metadata expiration check: 0:07:35 ago on Mon 27 May 2024 11:53:18 AM UTC.

NetworkManager.x86_64             1:1.46.0-4.el9_4                 baseos
NetworkManager-libnm.x86_64       1:1.46.0-4.el9_4                 baseos
acl.x86_64                        2.3.1-4.el9                      baseos
almalinux-gpg-keys.x86_64         9.4-1.el9                        baseos
almalinux-release.x86_64          9.4-1.el9                        baseos
almalinux-repos.x86_64            9.4-1.el9                        baseos
alternatives.x86_64               1.24-1.el9                       baseos
audit-libs.x86_64                 3.1.2-2.el9                      baseos
bash.x86_64                       5.1.8-9.el9                      baseos
ca-certificates.noarch            2023.2.60_v7.0.306-90.1.el9_2    baseos
中略
systemd.x86_64                    252-32.el9_4.alma.1              baseos
systemd-libs.x86_64               252-32.el9_4.alma.1              baseos
systemd-pam.x86_64                252-32.el9_4.alma.1              baseos
systemd-rpm-macros.noarch         252-32.el9_4.alma.1              baseos
systemd-udev.x86_64               252-32.el9_4.alma.1              baseos
tpm2-tss.x86_64                   3.2.2-2.el9                      baseos
tzdata.noarch                     2024a-1.el9                      baseos
util-linux.x86_64                 2.37.4-18.el9                    baseos
util-linux-core.x86_64            2.37.4-18.el9                    baseos
vim-minimal.x86_64                2:8.2.2637-20.el9_1              baseos
yum.noarch                        4.14.0-9.el9.alma.1              baseos
zlib.x86_64                       1.2.11-40.el9                    baseos
Obsoleting Packages
systemd-udev.x86_64               252-32.el9_4.alma.1              baseos
    systemd-udev.x86_64           250-6.el9_0.1                    @baseos
```
たくさん出てきました。このコマンド実行時にはAlmaLinux9.4が最新なので、9.4をターゲットとして、アップデートするべきパッケージ情報が表示されています。

ではアップデートを行います。`dnf check-update`コマンドを実行したのはsudo権限を与えていない一般ユーザだったので、今回はrootユーザに切り替えてから実行してみます。

```bash
su -
```
```bash
Password:
Last login: Wed May 22 15:56:13 UTC 2024 on pts/3
Last failed login: Mon May 27 12:04:24 UTC 2024 on pts/3
There was 1 failed login attempt since the last successful login.
[root@AL ~]# dnf upgrade
Last metadata expiration check: 3:49:24 ago on Mon 27 May 2024 08:15:10 AM UTC.
Dependencies resolved.
======================================================================================================
 Package                          Arch        Version                            Repository      Size
======================================================================================================
Upgrading:
 NetworkManager                   x86_64      1:1.46.0-4.el9_4                   baseos         2.3 M
 NetworkManager-libnm             x86_64      1:1.46.0-4.el9_4                   baseos         1.8 M
 acl                              x86_64      2.3.1-4.el9                        baseos          69 k
 almalinux-gpg-keys               x86_64      9.4-1.el9                          baseos         9.6 k
 almalinux-release                x86_64      9.4-1.el9                          baseos          20 k
 almalinux-repos                  x86_64      9.4-1.el9                          baseos         9.7 k
 alternatives                     x86_64      1.24-1.el9                         baseos          38 k
 audit-libs                       x86_64      3.1.2-2.el9                        baseos         117 k
 bash                             x86_64      5.1.8-9.el9                        baseos         1.7 M
 ca-certificates                  noarch      2023.2.60_v7.0.306-90.1.el9_2      baseos         835 k
 中略
  systemd                          x86_64      252-32.el9_4.alma.1                baseos         4.0 M
 systemd-libs                     x86_64      252-32.el9_4.alma.1                baseos         671 k
 systemd-pam                      x86_64      252-32.el9_4.alma.1                baseos         279 k
 systemd-rpm-macros               noarch      252-32.el9_4.alma.1                baseos          67 k
 systemd-udev                     x86_64      252-32.el9_4.alma.1                baseos         1.8 M
 tpm2-tss                         x86_64      3.2.2-2.el9                        baseos         591 k
 tzdata                           noarch      2024a-1.el9                        baseos         430 k
 util-linux                       x86_64      2.37.4-18.el9                      baseos         2.2 M
 util-linux-core                  x86_64      2.37.4-18.el9                      baseos         432 k
 vim-minimal                      x86_64      2:8.2.2637-20.el9_1                baseos         674 k
 yum                              noarch      4.14.0-9.el9.alma.1                baseos          84 k
 zlib                             x86_64      1.2.11-40.el9                      baseos          90 k
Installing dependencies:
 dbus-libs                        x86_64      1:1.12.20-8.el9                    baseos         151 k
 kbd-legacy                       noarch      2.4.0-9.el9                        baseos         502 k
Installing weak dependencies:
 libxcrypt-compat                 x86_64      4.4.18-3.el9                       appstream       88 k
 python3-dbus                     x86_64      1.2.18-2.el9                       baseos         132 k
 rpm-plugin-systemd-inhibit       x86_64      4.16.1.3-29.el9                    appstream       15 k

Transaction Summary
======================================================================================================
Install    5 Packages
Upgrade  136 Packages

Total download size: 74 M
Is this ok [y/N]:y
Downloading Packages:
(1/141): rpm-plugin-systemd-inhibit-4.16.1.3-29.el9.x86_64.rpm         80 kB/s |  15 kB     00:00
(2/141): libxcrypt-compat-4.4.18-3.el9.x86_64.rpm                     180 kB/s |  88 kB     00:00
(3/141): dbus-libs-1.12.20-8.el9.x86_64.rpm                           240 kB/s | 151 kB     00:00
(4/141): python3-dbus-1.2.18-2.el9.x86_64.rpm                         482 kB/s | 132 kB     00:00
(5/141): kbd-legacy-2.4.0-9.el9.noarch.rpm                            707 kB/s | 502 kB     00:00
(6/141): libestr-0.1.11-4.el9.x86_64.rpm                               98 kB/s |  25 kB     00:00
中略
(140/141): zlib-1.2.11-40.el9.x86_64.rpm                              272 kB/s |  90 kB     00:00
(141/141): util-linux-2.37.4-18.el9.x86_64.rpm                        1.6 MB/s | 2.2 MB     00:01
------------------------------------------------------------------------------------------------------
Total                                                                 3.0 MB/s |  74 MB     00:24
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                              1/1
  Upgrading        : libgcc-11.4.1-3.el9.alma.1.x86_64                                          1/277
  Running scriptlet: libgcc-11.4.1-3.el9.alma.1.x86_64                                          1/277
  Upgrading        : crypto-policies-20240202-1.git283706d.el9.noarch                           2/277
  Running scriptlet: crypto-policies-20240202-1.git283706d.el9.noarch                           2/277
  Upgrading        : tzdata-2024a-1.el9.noarch                                                  3/277
  Upgrading        : glibc-gconv-extra-2.34-100.el9.x86_64                                      4/277
  Running scriptlet: glibc-gconv-extra-2.34-100.el9.x86_64                                      4/277
  Upgrading        : glibc-langpack-en-2.34-100.el9.x86_64                                      5/277
  中略
  Verifying        : yum-4.10.0-5.el9_0.alma.noarch                                           275/277
  Verifying        : zlib-1.2.11-40.el9.x86_64                                                276/277
  Verifying        : zlib-1.2.11-32.el9_0.x86_64                                              277/277

Upgraded:
  NetworkManager-1:1.46.0-4.el9_4.x86_64         NetworkManager-libnm-1:1.46.0-4.el9_4.x86_64
  acl-2.3.1-4.el9.x86_64                         almalinux-gpg-keys-9.4-1.el9.x86_64
  almalinux-release-9.4-1.el9.x86_64             almalinux-repos-9.4-1.el9.x86_64
  alternatives-1.24-1.el9.x86_64                 audit-libs-3.1.2-2.el9.x86_64
  bash-5.1.8-9.el9.x86_64                        ca-certificates-2023.2.60_v7.0.306-90.1.el9_2.noarch
  中略
  systemd-252-32.el9_4.alma.1.x86_64             systemd-libs-252-32.el9_4.alma.1.x86_64
  systemd-pam-252-32.el9_4.alma.1.x86_64         systemd-rpm-macros-252-32.el9_4.alma.1.noarch
  systemd-udev-252-32.el9_4.alma.1.x86_64        tpm2-tss-3.2.2-2.el9.x86_64
  tzdata-2024a-1.el9.noarch                      util-linux-2.37.4-18.el9.x86_64
  util-linux-core-2.37.4-18.el9.x86_64           vim-minimal-2:8.2.2637-20.el9_1.x86_64
  yum-4.14.0-9.el9.alma.1.noarch                 zlib-1.2.11-40.el9.x86_64
Installed:
  dbus-libs-1:1.12.20-8.el9.x86_64                           kbd-legacy-2.4.0-9.el9.noarch
  libxcrypt-compat-4.4.18-3.el9.x86_64                       python3-dbus-1.2.18-2.el9.x86_64
  rpm-plugin-systemd-inhibit-4.16.1.3-29.el9.x86_64

Complete!
 ```
 終了しました！再度os-releaseを確認してみましょう。

```bash
cat /etc/os-release
```
```bash
NAME="AlmaLinux"
VERSION="9.4 (Seafoam Ocelot)"
ID="almalinux"
ID_LIKE="rhel centos fedora"
VERSION_ID="9.4"
PLATFORM_ID="platform:el9"
PRETTY_NAME="AlmaLinux 9.4 (Seafoam Ocelot)"
ANSI_COLOR="0;34"
LOGO="fedora-logo-icon"
CPE_NAME="cpe:/o:almalinux:almalinux:9::baseos"
HOME_URL="https://almalinux.org/"
DOCUMENTATION_URL="https://wiki.almalinux.org/"
BUG_REPORT_URL="https://bugs.almalinux.org/"

ALMALINUX_MANTISBT_PROJECT="AlmaLinux-9"
ALMALINUX_MANTISBT_PROJECT_VERSION="9.4"
REDHAT_SUPPORT_PRODUCT="AlmaLinux"
REDHAT_SUPPORT_PRODUCT_VERSION="9.4"
SUPPORT_END=2032-06-01
```
Emerald Puma(9.0)からSeafoam Ocelot(9.4)へ変更されています。

念のため再起動します。

```bash
reboot now
```

## 指定のバージョンにアップデートする
本記事執筆時点の最新版は9.4なわけですが、何らかの理由でその途中の9.1なんかにしたいことがあるかもしれません。薄緑の猫はちょっと愛せないかも・・・という時があるかもしれません。
そんなときは`dnf update --releasever=9.1`のようにするとバージョンを指定してアップデートすることができます。

```bash
dnf update --releasever=9.1
```
```bash
AlmaLinux 9.1 - AppStream                                             2.4 MB/s | 9.6 MB     00:03
AlmaLinux 9.1 - BaseOS                                                1.5 MB/s | 5.2 MB     00:03
AlmaLinux 9.1 - Extras                                                9.0 kB/s |  17 kB     00:01
Last metadata expiration check: 0:00:01 ago on Mon 27 May 2024 12:47:41 PM UTC.
Dependencies resolved.
======================================================================================================
 Package                           Architecture Version                         Repository       Size
======================================================================================================
Upgrading:
 NetworkManager                    x86_64       1:1.40.0-2.el9_1                baseos          2.1 M
 NetworkManager-libnm              x86_64       1:1.40.0-2.el9_1                baseos          1.7 M
 almalinux-gpg-keys                x86_64       9.1-1.9.el9                     baseos          9.6 k
 almalinux-release                 x86_64       9.1-1.9.el9                     baseos           20 k
 almalinux-repos                   x86_64       9.1-1.9.el9                     baseos          9.7 k
 audit-libs                        x86_64       3.0.7-103.el9                   baseos          116 k
 bash                              x86_64       5.1.8-6.el9_1                   baseos          1.7 M
中略
 util-linux                        x86_64       2.37.4-9.el9                    baseos          2.2 M
 util-linux-core                   x86_64       2.37.4-9.el9                    baseos          434 k
 vim-minimal                       x86_64       2:8.2.2637-20.el9_1             baseos          674 k
 yum                               noarch       4.12.0-4.el9.alma               baseos           91 k
 zlib                              x86_64       1.2.11-35.el9_1                 baseos           90 k
Installing dependencies:
 dbus-libs                         x86_64       1:1.12.20-7.el9_1               baseos          152 k
Installing weak dependencies:
 python3-dbus                      x86_64       1.2.18-2.el9                    baseos          132 k
 rpm-plugin-systemd-inhibit        x86_64       4.16.1.3-19.el9_1               appstream        17 k

Transaction Summary
======================================================================================================
Install    3 Packages
Upgrade  107 Packages

Total download size: 60 M
Is this ok [y/N]:y
中略
  sudo-1.9.5p2-7.el9_1.1.x86_64                      systemd-250-12.el9_1.3.x86_64
  systemd-libs-250-12.el9_1.3.x86_64                 systemd-pam-250-12.el9_1.3.x86_64
  systemd-rpm-macros-250-12.el9_1.3.noarch           systemd-udev-250-12.el9_1.3.x86_64
  tpm2-tss-3.0.3-8.el9.x86_64                        tzdata-2023c-1.el9.noarch
  util-linux-2.37.4-9.el9.x86_64                     util-linux-core-2.37.4-9.el9.x86_64
  vim-minimal-2:8.2.2637-20.el9_1.x86_64             yum-4.12.0-4.el9.alma.noarch
  zlib-1.2.11-35.el9_1.x86_64
Installed:
  dbus-libs-1:1.12.20-7.el9_1.x86_64                 python3-dbus-1.2.18-2.el9.x86_64
  rpm-plugin-systemd-inhibit-4.16.1.3-19.el9_1.x86_64

Complete!
```

終了しました！こちらでもos-releaseを確認してみましょう。

```bash
cat /etc/os-release
```
```bash
NAME="AlmaLinux"
VERSION="9.1 (Lime Lynx)"
ID="almalinux"
ID_LIKE="rhel centos fedora"
VERSION_ID="9.1"
PLATFORM_ID="platform:el9"
PRETTY_NAME="AlmaLinux 9.1 (Lime Lynx)"
ANSI_COLOR="0;34"
LOGO="fedora-logo-icon"
CPE_NAME="cpe:/o:almalinux:almalinux:9::baseos"
HOME_URL="https://almalinux.org/"
DOCUMENTATION_URL="https://wiki.almalinux.org/"
BUG_REPORT_URL="https://bugs.almalinux.org/"

ALMALINUX_MANTISBT_PROJECT="AlmaLinux-9"
ALMALINUX_MANTISBT_PROJECT_VERSION="9.1"
REDHAT_SUPPORT_PRODUCT="AlmaLinux"
REDHAT_SUPPORT_PRODUCT_VERSION="9.1"
```

ばっちりLime Lynx(9.1)になってました！