話題の記事

[速報]Amazon Linux 2022がやってきた!(プレビュー版)

2021.11.23

この記事は公開されてから1年以上経過しています。情報が古い可能性がありますので、ご注意ください。

みなさんこんにちは、杉金です。
Amazon Linux 2の後継にあたるAmazon Linux 2022のプレビュー版がきましたね!ついに!!

公式リンク集

Amazon Linux 2022とは

Amazon Linux 2022(AL2022)はAWSが独自に提供するLinuxサーバOSです。Amazon Linux 2の後継として今回発表されました。AL2022以降、Amazon Linuxの新しいメジャーバージョンは2年ごとにリリースされ、四半期ごとのマイナーリリースが含まれ、5年間の長期サポートが付属するようです。特徴として、デフォルトでパッケージリポジトリが特定のバージョンにロックでき、継続的デプロイのセットアップを容易にします。また、デフォルトでSELinuxが有効になっています。AL2022は、AWS公式のFAQで次のように紹介されています。

Q: What is Amazon Linux 2022?

A: Amazon Linux 2022 (AL2022) is an Amazon distribution of the Linux operating system. It is a general-purpose rpm-based distribution and a successor to Amazon Linux 2. AL2022 simplifies planning for operating system upgrades. Starting with AL2022, a new major version of Amazon Linux releases every two years, includes minor quarterly releases, and comes with five years of long-term support. By default, AL2022 locks to a specific version of the package repository to make it easy to integrate into a continuous deployment setup. Finally, AL2022 comes with SELinux enabled in enforcing mode by default.

引用:Amazon Linux 2022 FAQs

Amazon Linux 2022の利点、注目機能

Amazon Linux 2022の利点、注目機能をまとめました。

  • AWS向けに最適化
    • Amazon EC2向けに最適化されており、最新のAWS機能と統合している。
  • オペレーティングシステムのライフサイクルの計画と管理が簡単
    • Fedoraに基づいて、AL2022は頻繁で柔軟な四半期ごとのアップデートを提供する。
    • Amazon Linuxパッケージリポジトリのバージョンをロックして更新を制御できる。
    • メジャーバージョンアップは2年毎に提供され、各バージョンは5年間の長期サポートを受けられる。
    • サポートフェーズ中は定期的なセキュリティ更新、バグ修正が受けられる。
  • 高いセキュリティ標準
    • デフォルトでSELinux有効化
    • 起動時に事前構成済みのセキュリティポリシーを適用できる。
    • カーネルロックダウンやセキュアブート関連の機能強化。
  • カーネルライブパッチ
    • 再起動やダウンタイム無しでパッチ適用可能:プレビュー版は利用不可

詳細はGitHubのページをご確認ください。

サポートするCPUアーキテクチャ

以下のアーキテクチャに対応しています。

  • x86_64
  • aarch64

とりあえず使ってみる!

EC2インスタンス起動からコミュニティAMIを選び、「al2022」と入力するとAMIが出てきます。

インスタンス詳細設定を進めている時に気づいたのですが、Amazon Linux 2のEBSタイプはデフォルトgp2なのですがAmazon Linux 2022はgp3になってますね。

その後も進めていき...起動しましたあああ!!!プレビュー版と表示されています。

       __|  __|_  )
       _|  (     /   Amazon Linux 2022 AMI
      ___|\___|___|  Preview

http://aws.amazon.com/linux/amazon-linux-2022
Last login: Mon Nov 22 23:51:11 2021 from 103.5.140.162
[ec2-user@ip-10-0-0-26 ~]$ cat /etc/system-release
Amazon Linux release 2022 (Amazon Linux)

Kernelのバージョンは5.10.75になっています。Amazon Linux 2でも5.10は提供されているため、後ほどAmazon Linux 2とAmazon Linux 2022を比較してみましょう。

[ec2-user@ip-10-0-0-26 ~]$ uname -a
Linux ip-10-0-0-26.ap-northeast-1.compute.internal 5.10.75-82.359.amzn2022.x86_64 #1 SMP Mon Nov 15 18:04:59 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

登録されているサービスのリストです。

[ec2-user@ip-10-0-0-26 ~]$ systemctl list-unit-files --type=service
UNIT FILE                              STATE           VENDOR PRESET
arp-ethers.service                     disabled        disabled
atd.service                            enabled         enabled
auditd.service                         enabled         enabled
auth-rpcgss-module.service             static          -
autovt@.service                        alias           -
blk-availability.service               disabled        disabled
chrony-wait.service                    disabled        disabled
chronyd.service                        enabled         enabled
cloud-config.service                   enabled         disabled
cloud-final.service                    enabled         disabled
cloud-init-local.service               enabled         disabled
cloud-init.service                     enabled         disabled
console-getty.service                  disabled        disabled
container-getty@.service               static          -
cpupower.service                       disabled        disabled
dbus-broker.service                    enabled         enabled
dbus-org.freedesktop.home1.service     alias           -
dbus-org.freedesktop.hostname1.service alias           -
dbus-org.freedesktop.locale1.service   alias           -
dbus-org.freedesktop.login1.service    alias           -
dbus-org.freedesktop.network1.service  alias           -
dbus-org.freedesktop.oom1.service      alias           -
dbus-org.freedesktop.portable1.service alias           -
dbus-org.freedesktop.resolve1.service  alias           -
dbus-org.freedesktop.timedate1.service alias           -
dbus.service                           alias           -
debug-shell.service                    disabled        disabled
dm-event.service                       static          -
dmraid-activation.service              disabled        enabled
dnf-makecache.service                  static          -
dracut-cmdline.service                 static          -
dracut-initqueue.service               static          -
dracut-mount.service                   static          -
dracut-pre-mount.service               static          -
dracut-pre-pivot.service               static          -
dracut-pre-trigger.service             static          -
dracut-pre-udev.service                static          -
dracut-shutdown.service                static          -
emergency.service                      static          -
fstrim.service                         static          -
getty@.service                         enabled         enabled
grub-boot-indeterminate.service        static          -
grub2-systemd-integration.service      static          -
gssproxy.service                       disabled        disabled
import-state.service                   enabled         enabled
initrd-cleanup.service                 static          -
initrd-parse-etc.service               static          -
initrd-switch-root.service             static          -
initrd-udevadm-cleanup-db.service      static          -
irqbalance.service                     enabled         enabled
kmod-static-nodes.service              static          -
ldconfig.service                       static          -
libstoragemgmt.service                 enabled         enabled
loadmodules.service                    disabled        disabled
logrotate.service                      static          -
lvm2-lvmpolld.service                  static          -
lvm2-monitor.service                   enabled         enabled
lvm2-pvscan@.service                   static          -
man-db-cache-update.service            static          -
man-db-restart-cache-update.service    disabled        disabled
mdadm-grow-continue@.service           static          -
mdadm-last-resort@.service             static          -
mdmon@.service                         static          -
mdmonitor.service                      enabled         enabled
modprobe@.service                      static          -
nfs-blkmap.service                     disabled        disabled
nfs-convert.service                    enabled         disabled
nfs-idmapd.service                     static          -
nfs-mountd.service                     static          -
nfs-server.service                     disabled        disabled
nfs-utils.service                      static          -
nfsdcld.service                        static          -
nis-domainname.service                 disabled        disabled
pam_namespace.service                  static          -
policy-routes@.service                 static          -
quotaon.service                        static          -
raid-check.service                     static          -
rc-local.service                       static          -
rdisc.service                          disabled        disabled
refresh-policy-routes@.service         static          -
rescue.service                         static          -
rngd.service                           enabled         enabled
rpc-gssd.service                       static          -
rpc-statd-notify.service               static          -
rpc-statd.service                      static          -
rpcbind.service                        disabled        disabled
rpmdb-rebuild.service                  enabled         enabled
rsyslog.service                        enabled         enabled
selinux-autorelabel-mark.service       enabled         enabled
selinux-autorelabel.service            static          -
selinux-check-proper-disable.service   disabled        disabled
serial-getty@.service                  indirect        disabled
sshd-keygen@.service                   disabled        disabled
sshd.service                           enabled         enabled
sshd@.service                          static          -
sssd-autofs.service                    indirect        disabled
sssd-kcm.service                       indirect        disabled
sssd-nss.service                       indirect        disabled
sssd-pac.service                       indirect        disabled
sssd-pam.service                       indirect        disabled
sssd-ssh.service                       indirect        disabled
sssd-sudo.service                      indirect        disabled
sssd.service                           enabled         enabled
sysstat-collect.service                static          -
sysstat-summary.service                static          -
sysstat.service                        enabled         enabled
system-update-cleanup.service          static          -
systemd-ask-password-console.service   static          -
systemd-ask-password-wall.service      static          -
systemd-backlight@.service             static          -
systemd-binfmt.service                 static          -
systemd-bless-boot.service             static          -
systemd-boot-check-no-failures.service disabled        disabled
systemd-boot-system-token.service      static          -
systemd-coredump@.service              static          -
systemd-exit.service                   static          -
systemd-firstboot.service              static          -
systemd-fsck-root.service              enabled-runtime disabled
systemd-fsck@.service                  static          -
systemd-halt.service                   static          -
systemd-hibernate-resume@.service      static          -
systemd-hibernate.service              static          -
systemd-homed-activate.service         enabled         disabled
systemd-homed.service                  enabled         enabled
systemd-hostnamed.service              static          -
systemd-hwdb-update.service            static          -
systemd-hybrid-sleep.service           static          -
systemd-initctl.service                static          -
systemd-journal-catalog-update.service static          -
systemd-journal-flush.service          static          -
systemd-journald.service               static          -
systemd-journald@.service              static          -
systemd-kexec.service                  static          -
systemd-localed.service                static          -
systemd-logind.service                 static          -
systemd-machine-id-commit.service      static          -
systemd-modules-load.service           static          -
systemd-network-generator.service      disabled        disabled
systemd-networkd-wait-online.service   enabled         disabled
systemd-networkd.service               enabled         disabled
systemd-oomd.service                   disabled        disabled
systemd-portabled.service              static          -
systemd-poweroff.service               static          -
systemd-pstore.service                 disabled        enabled
systemd-quotacheck.service             static          -
systemd-random-seed.service            static          -
systemd-reboot.service                 static          -
systemd-remount-fs.service             enabled-runtime disabled
systemd-repart.service                 static          -
systemd-resolved.service               enabled         enabled
systemd-rfkill.service                 static          -
systemd-suspend-then-hibernate.service static          -
systemd-suspend.service                static          -
systemd-sysctl.service                 static          -
systemd-sysext.service                 disabled        disabled
systemd-sysusers.service               static          -
systemd-time-wait-sync.service         disabled        disabled
systemd-timedated.service              static          -
systemd-timesyncd.service              disabled        disabled
systemd-tmpfiles-clean.service         static          -
systemd-tmpfiles-setup-dev.service     static          -
systemd-tmpfiles-setup.service         static          -
systemd-udev-settle.service            static          -
systemd-udev-trigger.service           static          -
systemd-udevd.service                  static          -
systemd-update-done.service            static          -
systemd-update-utmp-runlevel.service   static          -
systemd-update-utmp.service            static          -
systemd-user-sessions.service          static          -
systemd-userdbd.service                indirect        disabled
systemd-vconsole-setup.service         static          -
systemd-volatile-root.service          static          -
update-motd.service                    enabled         enabled
user-runtime-dir@.service              static          -
user@.service                          static          -

175 unit files listed.

Amazon Linux 2と見比べ

Amazon Linux 2のカーネルバージョン5.10を起動して比較してみましょう。

Amazon Linux 2(5.10)のカーネルバージョン

[ec2-user@ip-10-0-0-10 ~]$ uname -a
Linux ip-10-0-0-8.ap-northeast-1.compute.internal 5.10.75-79.358.amzn2.x86_64 #1 SMP Thu Nov 4 21:08:30 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

SELinuxの比較

アナウンスにある通りSELinuxが有効になっています。

Amazon Linux 2022

[ec2-user@ip-10-0-0-26 ~]$ getenforce
Enforcing

Amazon Linux 2

[ec2-user@ip-10-0-0-10 ~]$ getenforce
Disabled

セキュリティポリシーの比較

こちらもアナウンスにある通りDEFAULTに設定されています。Amazon Linux 2には無いものです。

Amazon Linux 2022

[ec2-user@ip-10-0-0-26 ~]$ update-crypto-policies --show
DEFAULT

Amazon Linux 2

[ec2-user@ip-10-0-0-10 ~]$ update-crypto-policies --show
-bash: update-crypto-policies: コマンドが見つかりません

セキュリティポリシーの種類と説明については、以下のRHEL8公式ページが分かりやすいです。

第4章 システム全体の暗号化ポリシーの使用

SSMエージェントの有無

Amazon Linux 2022

デフォルト未導入のようです。GitHubのissueにリクエストが上がっていますのでいずれ導入されると思われます。

Amazon Linux 2

Amazon Linux 2の場合はSSMエージェントはインストール済みです。

[ec2-user@ip-10-0-0-10 ~]$ sudo systemctl -l | grep ssm
amazon-ssm-agent.service                                                  loaded active running   amazon-ssm-agent

パッケージ管理

Amazon Linux 2022ではdnfでパッケージ管理ができるようになりました。amazon-linux-extrasは使えなくなっています

Amazon Linux 2022

[ec2-user@ip-10-0-0-26 ~]$ sudo amazon-linux-extras list
sudo: amazon-linux-extras: コマンドが見つかりません

Amazon Linux 2でnginxを導入する時はamazon-linux-extrasを利用していましたが、Amazon Linux 2022はdnfで検索すると出てきます。

[ec2-user@ip-10-0-0-26 ~]$ sudo dnf list | grep nginx.x86_64
nginx.x86_64                                                      1:1.20.1-8.amzn2022                        amazonlinux
pcp-pmda-nginx.x86_64                                             5.3.5-1.amzn2022                           amazonlinux

最後に

Amazon Linux 2022の起動と簡単な比較をしてみました。パブリックプレビュー版ですので追加要望の有無やバグがないか引き続き確認できればと思います。Amazon Linux 2のサポートが2023/6/30まででしたので、待ちに待ち望んだアップデートです。今後のバージョンアップのロードマップも分かって一安心です。GAが待ち遠しいですね!