この記事は公開されてから1年以上経過しています。情報が古い可能性がありますので、ご注意ください。
ウィスキー、シガー、パイプをこよなく愛する大栗です。
先程Amazon Web Services向けに最適化されたLinuxディストリビューションであるAmazon Linuxの次世代版であるAmazon Linux 2が発表されましたのでご紹介します。
- Amazon Linux 2
- Announcement: Amazon Linux 2 LTS Release Candidate Available
- Introducing Amazon Linux 2
Amazon Linux 2は一般公開になり正式な5年サポートのLTS版が公開されています
Amazon Linux 2
Amazon Linux 2の特徴をまとめてみます。
- AWSとのインテグレーション:AWS CLIなどの多数のツールやcloud-initが付属している。
- 長期サポート:セキュリティアップデートとバグ修正を含む5年間の長期サポート。AWSはABIとAPIの互換性を5年間維持する。
- ソフトウェア・パッケージのExtraリポジトリ:Amazon Linux Extras repositoryを提供。Webやデスクトップ開発環境やオープンソースデータベースなどのソフトウェアアプリケーションが含まれる。
- オンプレミスでの使用:オンプレミスで使用するための仮想マシンイメージを提供。ローカル開発環境で開発、テスト、検証が可能。
- systemdサポート:Amazon Linux 2ではsystemdを使用してプロセスのブートストラップを行う。
- チューニングされたLTSカーネルと新しいツールチェーン:コンパイラとビルドツールチェーンの新バージョンとAmazon EC2のパフォーマンス向上のチューニングがされている。
- セキュリティ構成:SSHキーペアの使用とリモートのルートログイン不可によりリモートアクセスを制限する。重要でないパッケージのインストール数を減らして、潜在的なセキュリティ脆弱性を低減。
- セキュリティ更新プログラム:yumリポジトリ、AMIのアップデート、VMやコンテナを介してセキュリティアップデートを提供。セキュリティアラートはAmazon Linux AMI Security Centerで公開される。
今までのAmazon Linuxと大きく異る部分として、5年の長期サポート、オンプレミスでの使用、systemdサポートが 重要だと思われます。
現在はRelease Candidateであるため長期サポートはされません。長期サポートは最終的なLTSビルドで実施されます。
OSイメージのリポジトリを見ると以下の5種類イメージが用意されていることが分かります。FAQによると現在VMware、Microsoft Hyper-V、Oracle VM VirtualBoxが使用できるとのことです。
- Container
- Hyper-V
- KVM
- VirtualBox
- VMware
現在はRelease Candidate なのでGAの時期が気になります。
試してみる
実際にAmazon Linux 2をEC2で起動して試してみます。
環境
- リージョン:東京
- AMI:amzn2-ami-hvm-2017.12.0.20171212.2-x86_64-gp2 (ami-2a34b64c)
- インスタンスタイプ:t2.small
Amazon Linux 2のAMIはEC2の起動ウィザードから簡単に選択することが可能です。
ログイン
$ ssh ec2-user@ 203.0.113.1
Warning: Permanently added '203.0.113.1' (ECDSA) to the list of known hosts.
Last login: Wed Dec 13 22:55:33 2017 from local.example.com
__| __|_ )
_| ( / Amazon Linux 2 AMI
___|\___|___|
https://aws.amazon.com/amazon-linux-2/
[ec2-user@ip-192-0-2-1 ~]$
Linux Kernel
uname -a
でLinux Kernelのバージョンを確認します。Linux Kernelは4.9.62-10.57.amzn2.x86_64
が導入されています。Amazon Linux AMI 2017.09と同様に4.9系となっています。
$ uname -a
Linux ip-172-31-0-1 4.9.62-10.57.amzn2.x86_64 #1 SMP Wed Dec 6 00:07:49 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
system-releaseを確認します。
$ cat /etc/system-release
Amazon Linux release 2.0 (2017.12) LTS Release Candidate
Extras Library
Extras Libraryのトピックの内容を確認してみます。
$ amazon-linux-extras list
0 ansible2 disabled [ =2.4.2 ]
1 emacs disabled [ =25.3 ]
2 memcached1.5 disabled [ =1.5.1 ]
3 nginx1.12 disabled [ =1.12.2 ]
4 postgresql9.6 disabled [ =9.6.6 ]
5 python3 disabled [ =3.6.2 ]
6 redis4.0 disabled [ =4.0.5 ]
7 R3.4 disabled [ =3.4.3 ]
8 rust1 disabled [ =1.22.1 ]
9 vim disabled [ =8.0 ]
10 golang1.9 disabled [ =1.9.2 ]
11 ruby2.4 disabled [ =2.4.2 ]
12 nano disabled [ =2.9.1 ]
13 php7.2 disabled [ =7.2.0 ]
systemdの内容
ちょっと長いですがサービスの一覧を確認してみます。RHEL7やCent7とは異なりファイアウォールにfirewalldを使用していないようです。
$ systemctl list-units --no-pager -all
UNIT LOAD ACTIVE SUB DESCRIPTION
proc-sys-fs-binfmt_misc.automount loaded active waiting Arbitrary Executable File Formats File System Automount Point
dev-disk-by\x2dlabel-\x5cx2f.device loaded active plugged /dev/disk/by-label/\x2f
dev-disk-by\x2dpartlabel-Linux.device loaded active plugged /dev/disk/by-partlabel/Linux
dev-disk-by\x2dpartuuid-d5e3e326\x2d71cb\x2d4a72\x2db0ce\x2d1e23842c0a50.device loaded active plugged /dev/disk/by-partuuid/d5e3e326-71cb-4a72-b0ce-1e23842c0a50
dev-disk-by\x2duuid-c13e806a\x2d45e4\x2d45d4\x2da200\x2df993a9b67652.device loaded active plugged /dev/disk/by-uuid/c13e806a-45e4-45d4-a200-f993a9b67652
dev-sda.device loaded active plugged /dev/sda
dev-sda1.device loaded active plugged /dev/sda1
dev-ttyS0.device loaded active plugged /dev/ttyS0
dev-ttyS1.device loaded active plugged /dev/ttyS1
dev-ttyS2.device loaded active plugged /dev/ttyS2
dev-ttyS3.device loaded active plugged /dev/ttyS3
dev-xvda.device loaded active plugged /dev/xvda
dev-xvda1.device loaded active plugged /dev/xvda1
sys-devices-platform-serial8250-tty-ttyS1.device loaded active plugged /sys/devices/platform/serial8250/tty/ttyS1
sys-devices-platform-serial8250-tty-ttyS2.device loaded active plugged /sys/devices/platform/serial8250/tty/ttyS2
sys-devices-platform-serial8250-tty-ttyS3.device loaded active plugged /sys/devices/platform/serial8250/tty/ttyS3
sys-devices-pnp0-00:06-tty-ttyS0.device loaded active plugged /sys/devices/pnp0/00:06/tty/ttyS0
sys-devices-vbd\x2d51712-block-xvda-xvda1.device loaded active plugged /sys/devices/vbd-51712/block/xvda/xvda1
sys-devices-vbd\x2d51712-block-xvda.device loaded active plugged /sys/devices/vbd-51712/block/xvda
sys-devices-vif\x2d0-net-eth0.device loaded active plugged /sys/devices/vif-0/net/eth0
sys-subsystem-net-devices-eth0.device loaded active plugged /sys/subsystem/net/devices/eth0
-.mount loaded active mounted /
dev-hugepages.mount loaded active mounted Huge Pages File System
dev-mqueue.mount loaded active mounted POSIX Message Queue File System
proc-fs-nfsd.mount loaded active mounted NFSD configuration filesystem
proc-sys-fs-binfmt_misc.mount loaded inactive dead Arbitrary Executable File Formats File System
run-user-1000.mount loaded active mounted /run/user/1000
sys-fs-fuse-connections.mount loaded inactive dead FUSE Control File System
sys-kernel-config.mount loaded inactive dead Configuration File System
sys-kernel-debug.mount loaded active mounted Debug File System
tmp.mount loaded inactive dead Temporary Directory
var-lib-nfs-rpc_pipefs.mount loaded active mounted RPC Pipe File System
brandbot.path loaded active waiting Flexible branding
systemd-ask-password-console.path loaded inactive dead Dispatch Password Requests to Console Directory Watch
systemd-ask-password-plymouth.path loaded active waiting Forward Password Requests to Plymouth Directory Watch
systemd-ask-password-wall.path loaded active waiting Forward Password Requests to Wall Directory Watch
session-1.scope loaded active running Session 1 of user ec2-user
amazon-ssm-agent.service loaded active running amazon-ssm-agent
atd.service loaded active running Job spooling tools
auditd.service loaded active running Security Auditing Service
auth-rpcgss-module.service loaded inactive dead Kernel Module supporting RPCSEC_GSS
brandbot.service loaded inactive dead Flexible Branding Service
chronyd.service loaded active running NTP client/server
cloud-config.service loaded active exited Apply the settings specified in cloud-config
cloud-final.service loaded active exited Execute cloud user/final scripts
cloud-init-local.service loaded active exited Initial cloud-init job (pre-networking)
cloud-init.service loaded active exited Initial cloud-init job (metadata service crawler)
crond.service loaded active running Command Scheduler
dbus.service loaded active running D-Bus System Message Bus
● display-manager.service not-found inactive dead display-manager.service
dm-event.service loaded inactive dead Device-mapper event daemon
dmraid-activation.service loaded inactive dead Activation of DM RAID sets
dracut-shutdown.service loaded inactive dead Restore /run/initramfs
ec2net-ifup@eth0.service loaded inactive dead Enable elastic network interfaces eth0
emergency.service loaded inactive dead Emergency Shell
● exim.service not-found inactive dead exim.service
getty@tty1.service loaded active running Getty on tty1
gssproxy.service loaded active running GSSAPI Proxy Daemon
● ip6tables.service not-found inactive dead ip6tables.service
● iptables.service not-found inactive dead iptables.service
kmod-static-nodes.service loaded active exited Create list of required static device nodes for the current kernel
libstoragemgmt.service loaded active running libstoragemgmt plug-in server daemon
● lvm2-activation-early.service not-found inactive dead lvm2-activation-early.service
● lvm2-activation.service not-found inactive dead lvm2-activation.service
lvm2-lvmetad.service loaded active running LVM2 metadata daemon
lvm2-lvmpolld.service loaded inactive dead LVM2 poll daemon
lvm2-monitor.service loaded active exited Monitoring of LVM2 mirrors, snapshots etc. using dmeventd or progress polling
mdmonitor.service loaded inactive dead Software RAID monitoring and management
network.service loaded active running LSB: Bring up/down networking
● NetworkManager-wait-online.service not-found inactive dead NetworkManager-wait-online.service
● NetworkManager.service not-found inactive dead NetworkManager.service
nfs-config.service loaded inactive dead Preprocess NFS configuration
nfs-idmapd.service loaded inactive dead NFSv4 ID-name mapping service
nfs-mountd.service loaded inactive dead NFS Mount Daemon
● nfs-secure-server.service not-found inactive dead nfs-secure-server.service
nfs-server.service loaded inactive dead NFS server and services
nfs-utils.service loaded inactive dead NFS server and client services
● ntpd.service not-found inactive dead ntpd.service
● ntpdate.service not-found inactive dead ntpdate.service
plymouth-quit-wait.service loaded inactive dead Wait for Plymouth Boot Screen to Quit
plymouth-quit.service loaded inactive dead Terminate Plymouth Boot Screen
plymouth-read-write.service loaded inactive dead Tell Plymouth To Write Out Runtime Data
plymouth-start.service loaded inactive dead Show Plymouth Boot Screen
postfix.service loaded active running Postfix Mail Transport Agent
rc-local.service loaded inactive dead /etc/rc.d/rc.local Compatibility
rescue.service loaded inactive dead Rescue Shell
rhel-autorelabel-mark.service loaded active exited Mark the need to relabel after reboot
rhel-autorelabel.service loaded inactive dead Relabel all filesystems, if necessary
rhel-configure.service loaded inactive dead Reconfigure the system on administrator request
rhel-dmesg.service loaded active exited Dump dmesg to /var/log/dmesg
rhel-import-state.service loaded inactive dead Import network configuration from initramfs
rhel-loadmodules.service loaded inactive dead Load legacy module configuration
rhel-readonly.service loaded active exited Configure read-only root support
rngd.service loaded active running Hardware RNG Entropy Gatherer Daemon
rpc-gssd.service loaded inactive dead RPC security service for NFS client and server
rpc-statd-notify.service loaded inactive dead Notify NFS peers of a restart
rpc-statd.service loaded inactive dead NFS status monitor for NFSv2/3 locking.
rpcbind.service loaded inactive dead RPC bind service
selinux-policy-migrate-local-changes@targeted.service loaded inactive dead Migrate local SELinux policy changes from the old store structure to the new structure
● sendmail.service not-found inactive dead sendmail.service
serial-getty@ttyS0.service loaded active running Serial Getty on ttyS0
● sntp.service not-found inactive dead sntp.service
sshd-keygen.service loaded inactive dead OpenSSH Server Key Generation
sshd.service loaded active running OpenSSH server daemon
● syslog.service not-found inactive dead syslog.service
sysstat.service loaded active exited Resets System Activity Logs
systemd-ask-password-console.service loaded inactive dead Dispatch Password Requests to Console
systemd-ask-password-plymouth.service loaded inactive dead Forward Password Requests to Plymouth
systemd-ask-password-wall.service loaded inactive dead Forward Password Requests to Wall
systemd-binfmt.service loaded inactive dead Set Up Additional Binary Formats
systemd-firstboot.service loaded inactive dead First Boot Wizard
systemd-fsck-root.service loaded active exited File System Check on Root Device
systemd-hwdb-update.service loaded active exited Rebuild Hardware Database
systemd-initctl.service loaded inactive dead /dev/initctl Compatibility Daemon
systemd-journal-catalog-update.service loaded active exited Rebuild Journal Catalog
systemd-journal-flush.service loaded active exited Flush Journal to Persistent Storage
systemd-journald.service loaded active running Journal Service
systemd-logind.service loaded active running Login Service
systemd-machine-id-commit.service loaded inactive dead Commit a transient machine-id on disk
systemd-modules-load.service loaded active exited Load Kernel Modules
● systemd-random-seed-load.service not-found inactive dead systemd-random-seed-load.service
systemd-random-seed.service loaded active exited Load/Save Random Seed
systemd-readahead-collect.service loaded inactive dead Collect Read-Ahead Data
systemd-readahead-done.service loaded inactive dead Stop Read-Ahead Data Collection
systemd-readahead-replay.service loaded inactive dead Replay Read-Ahead Data
systemd-reboot.service loaded inactive dead Reboot
systemd-remount-fs.service loaded active exited Remount Root and Kernel File Systems
systemd-shutdownd.service loaded inactive dead Delayed Shutdown Service
systemd-sysctl.service loaded active exited Apply Kernel Variables
● systemd-sysusers.service not-found inactive dead systemd-sysusers.service
● systemd-timesyncd.service not-found inactive dead systemd-timesyncd.service
systemd-tmpfiles-clean.service loaded inactive dead Cleanup of Temporary Directories
systemd-tmpfiles-setup-dev.service loaded active exited Create Static Device Nodes in /dev
systemd-tmpfiles-setup.service loaded active exited Create Volatile Files and Directories
systemd-udev-settle.service loaded active exited udev Wait for Complete Device Initialization
systemd-udev-trigger.service loaded active exited udev Coldplug all Devices
systemd-udevd.service loaded active running udev Kernel Device Manager
systemd-update-done.service loaded active exited Update is Completed
systemd-update-utmp-runlevel.service loaded inactive dead Update UTMP about System Runlevel Changes
systemd-update-utmp.service loaded active exited Update UTMP about System Boot/Shutdown
systemd-user-sessions.service loaded active exited Permit User Sessions
systemd-vconsole-setup.service loaded active exited Setup Virtual Console
update-motd.service loaded active exited Dynamically Generate Message Of The Day
-.slice loaded active active Root Slice
system-ec2net\x2difup.slice loaded active active system-ec2net\x2difup.slice
system-getty.slice loaded active active system-getty.slice
system-selinux\x2dpolicy\x2dmigrate\x2dlocal\x2dchanges.slice loaded active active system-selinux\x2dpolicy\x2dmigrate\x2dlocal\x2dchanges.slice
system-serial\x2dgetty.slice loaded active active system-serial\x2dgetty.slice
system.slice loaded active active System Slice
user-1000.slice loaded active active User Slice of ec2-user
user.slice loaded active active User and Session Slice
dbus.socket loaded active running D-Bus System Message Bus Socket
dm-event.socket loaded active listening Device-mapper event daemon FIFOs
lvm2-lvmetad.socket loaded active running LVM2 metadata daemon socket
lvm2-lvmpolld.socket loaded active listening LVM2 poll daemon socket
rpcbind.socket loaded active listening RPCbind Server Activation Socket
sshd.socket loaded inactive dead OpenSSH Server Socket
syslog.socket loaded inactive dead Syslog Socket
systemd-initctl.socket loaded active listening /dev/initctl Compatibility Named Pipe
systemd-journald.socket loaded active running Journal Socket
systemd-shutdownd.socket loaded active listening Delayed Shutdown Socket
systemd-udevd-control.socket loaded active running udev Control Socket
systemd-udevd-kernel.socket loaded active running udev Kernel Socket
basic.target loaded active active Basic System
cloud-config.target loaded active active Cloud-config availability
cloud-init.target loaded active active Cloud-init target
cryptsetup.target loaded active active Encrypted Volumes
emergency.target loaded inactive dead Emergency Mode
final.target loaded inactive dead Final Step
getty.target loaded active active Login Prompts
graphical.target loaded active active Graphical Interface
local-fs-pre.target loaded active active Local File Systems (Pre)
local-fs.target loaded active active Local File Systems
multi-user.target loaded active active Multi-User System
network-online.target loaded active active Network is Online
network-pre.target loaded active active Network (Pre)
network.target loaded active active Network
nfs-client.target loaded active active NFS client services
nss-lookup.target loaded inactive dead Host and Network Name Lookups
nss-user-lookup.target loaded inactive dead User and Group Name Lookups
paths.target loaded active active Paths
remote-fs-pre.target loaded active active Remote File Systems (Pre)
remote-fs.target loaded active active Remote File Systems
rescue.target loaded inactive dead Rescue Mode
shutdown.target loaded inactive dead Shutdown
slices.target loaded active active Slices
sockets.target loaded active active Sockets
swap.target loaded active active Swap
sysinit.target loaded active active System Initialization
● syslog.target not-found inactive dead syslog.target
time-sync.target loaded inactive dead System Time Synchronized
timers.target loaded active active Timers
umount.target loaded inactive dead Unmount All Filesystems
systemd-readahead-done.timer loaded inactive dead Stop Read-Ahead Data Collection 10s After Completed Startup
systemd-tmpfiles-clean.timer loaded active waiting Daily Cleanup of Temporary Directories
LOAD = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB = The low-level unit activation state, values depend on unit type.
195 loaded units listed.
To show all installed unit files use 'systemctl list-unit-files'.
ファイルシステム
ファイルシステムを確認するとext4からxfsに変更されていることが分かります。
$ df -Th
Filesystem Type Size Used Avail Use% Mounted on
devtmpfs devtmpfs 988M 0 988M 0% /dev
tmpfs tmpfs 1001M 0 1001M 0% /dev/shm
tmpfs tmpfs 1001M 17M 985M 2% /run
tmpfs tmpfs 1001M 0 1001M 0% /sys/fs/cgroup
/dev/xvda1 xfs 100G 1.1G 99G 2% /
tmpfs tmpfs 201M 0 201M 0% /run/user/1000
既存バージョンのサポートに関する注意
Amazon Linux 2が利用可能になったことにより既存バージョンのAmazon Linux(2017.09)に変更はあるか?
Amazon Linux 2のリリースにより、既存のAmazon Linuxは現行のAmazon Linux 2017.09が最終リリースとなります。
現在のAmazon Linuxのサポートは?
既存のAmazon Linuxの定期的なセキュリティアップデートはAmazon Linux 2の最終LTSビルドが発表されてから2年間提供されます。
Amazon Linux 2は既存のAmazon Linuxと互換性があるか?
Amazon Linux 2にはsystemdのような新しいコンポーネントが含まれているため、既存バージョンのAmazon Linuxで動作するアプリケーションではAmazon Linux 2で変更が必要になる場合があります。
既存バージョンのAmazon LinuxをAmazon Linux 2へインプレースアップグレードできるか?
できません。既存のAmazon LinuxイメージからAmazon Linux 2へのインプレースアップグレードはサポートされていません。移行前に新規インストールのAmazon Linux 2でアプリケーションをテストすることをお勧めします。
既存のAmazon LinuxインスタンスでAmazon Linux 2へローリングアップグレードできるか?
できません。Amazon Linuxを実行しているインスタンスはローリングアップグレードを使用してAmazon Linux 2へアップグレードできません。そのため既存アプリケーションに影響はありません。
さいごに
今までのAmazon Linuxは半年ごとにアップデートされて、既存バージョンのリポジトリのアップデート期間も限定的でした。パッケージを更新していく環境ではアップデートに追随できるため問題ありませんでしたが、パッケージを保守的に運用する環境では導入が難しい面がありました。
Amazon Linux 2は5年の長期サポートに加え、オンプレミスの使用も可能であるためエンタープライズ環境での導入が進むのではないでしょうか。