覚えたら書く

IT関係のデベロッパとして日々覚えたことを書き残したいです。twitter: @yyoshikaw

WSL版のAlmaLinux をインストールする

Windows の WSLで CentOS 代替 の Linux を使いたいなーと思っていたら、ちょうど以下のニュースリリースが出てました。


せっかくなので、Red Hat Enterprise Linux(RHEL)とのバイナリ互換がある AlmaLinux をWindows環境にインストールしてみました。


前提

WSLは利用可能な環境であることを前提としています。


AlmaLinux のインストール

WSLでAlmaLinux を利用するのは簡単で、Microsoft Store で AlmaLinux 8 WSL を入手すればよいです。


私は何となく winget でインストールしてみました。
winget install AlmaLinux を実行すれば AlmaLinux がインストールされます。


■実行結果

何かごちゃごちゃやってますが、 winget install AlmaLinux を PowerShell で実行すればよいです

PS C:\Users\ykiv> winget search AlmaLinux
名前            ID           バージョン ソース
------------------------------------------------
AlmaLinux 8 WSL 9NMD96XJJ19F Unknown    msstore
PS C:\Users\ykiv>
PS C:\Users\ykiv>
PS C:\Users\ykiv> winget show AlmaLinux
見つかりました AlmaLinux 8 WSL [9NMD96XJJ19F]
バージョン: Unknown
公開元: AlmaLinux OS Foundation
発行元 URL: https://almalinux.org
発行元のサポート URL: https://almalinux.org
説明: AlmaLinux OS comes to WSL! Now you can run all you favorite EL ecosystem applications, using the platform you know and love using all the standard tools, including dnf/yum, etc.

AlmaLinux is the Community Owned and Governed Enterprise-Grade Linux OS and is 1:1 RHEL and CentOS compatible.


ライセンス: ms-windows-store://pdp/?ProductId=9NMD96XJJ19F
プライバシー URL: https://almalinux.org/p/privacy-policy/
著作権: AlmaLinux OS Foundation
契約:
Category: Developer tools
Pricing: Free
Free Trial: No
Terms of Transaction: https://aka.ms/microsoft-store-terms-of-transaction
Seizure Warning: https://aka.ms/microsoft-store-seizure-warning
Store License Terms: https://aka.ms/microsoft-store-license

インストーラー:
  種類: msstore
  ストア製品 ID: 9NMD96XJJ19F
PS C:\Users\ykiv>
PS C:\Users\ykiv>
PS C:\Users\ykiv> winget install AlmaLinux
見つかりました AlmaLinux 8 WSL [9NMD96XJJ19F] バージョン Unknown
このパッケージは Microsoft Store から提供されています。winget は、現在のユーザーに代わって Microsoft Store からパッケー ジを取得する必要がある場合があります。
バージョン: Unknown
公開元: AlmaLinux OS Foundation
発行元 URL: https://almalinux.org
発行元のサポート URL: https://almalinux.org
説明: AlmaLinux OS comes to WSL! Now you can run all you favorite EL ecosystem applications, using the platform you know and love using all the standard tools, including dnf/yum, etc.

AlmaLinux is the Community Owned and Governed Enterprise-Grade Linux OS and is 1:1 RHEL and CentOS compatible.


ライセンス: ms-windows-store://pdp/?ProductId=9NMD96XJJ19F
プライバシー URL: https://almalinux.org/p/privacy-policy/
著作権: AlmaLinux OS Foundation
契約:
Category: Developer tools
Pricing: Free
Free Trial: No
Terms of Transaction: https://aka.ms/microsoft-store-terms-of-transaction
Seizure Warning: https://aka.ms/microsoft-store-seizure-warning
Store License Terms: https://aka.ms/microsoft-store-license


発行元は、お客様がインストール前に上記の情報を表示し、契約に同意することを必要としています。
使用条件に同意しますか?
[Y] はい  [N] いいえ: Y
パッケージ取得の確認/要求...
パッケージ取得の成功の確認/要求
パッケージのインストールを開始しています...
  ██████████████████████████████  100%
インストールが完了しました
PS C:\Users\ykiv>


インストールが完了したら AlmaLinux を起動します。
そうするとターミナルが起動するので、AlmaLinux を利用するために新規作成するユーザ(とパスワード)を入力します。


■実行結果

Installing, this may take a few minutes...
Please create a default UNIX user account. The username does not need to match your Windows username.
For more information visit: https://aka.ms/wslusers
Enter new UNIX username: user-name
Changing password for user user-name.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
Installation successful!
[user-name@host-name:~]$

f:id:nini_y:20220409102301p:plain

これで WSL で利用可能となります。


f:id:nini_y:20220409102824p:plain

Windows Terminal にも AlmaLinux が追加されています。


OSの情報を見てみる

Windows Terminal で AlmaLinux を起動してOSの情報を少し確認してみました。

[~]$ uname -a
Linux host-name 5.10.102.1-microsoft-standard-WSL2 #1 SMP Wed Mar 2 00:30:59 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
[~]$
[~]$ cat /etc/redhat-release
AlmaLinux release 8.5 (Arctic Sphynx)
[~]$


ついでに neofetch もインストール してみました(以下コマンドを実行)。

sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm

sudo dnf install epel-release

sudo dnf install neofetch


■実行結果

[~]$ sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
AlmaLinux 8 - BaseOS                                                                         4.3 MB/s | 7.0 MB     00:01
AlmaLinux 8 - AppStream                                                                      3.0 MB/s | 9.8 MB     00:03
AlmaLinux 8 - Extras                                                                          13 kB/s |  12 kB     00:00
(中略)
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                     1/1
  Installing       : epel-release-8-15.el8.noarch                                                                        1/1
  Running scriptlet: epel-release-8-15.el8.noarch                                                                        1/1
  Verifying        : epel-release-8-15.el8.noarch                                                                        1/1

Installed:
  epel-release-8-15.el8.noarch

Complete!
[~]$
[~]$ sudo dnf install epel-release
Extra Packages for Enterprise Linux 8 - x86_64                                               4.1 MB/s |  11 MB     00:02
Extra Packages for Enterprise Linux Modular 8 - x86_64                                       941 kB/s | 1.0 MB     00:01
Last metadata expiration check: 0:00:01 ago on Sat Apr  9 09:58:52 2022.
Package epel-release-8-15.el8.noarch is already installed.
Dependencies resolved.
Nothing to do.
Complete!
[~]$
[~]$ sudo dnf install neofetch
Last metadata expiration check: 0:00:50 ago on Sat Apr  9 09:58:52 2022.
Dependencies resolved.
(中略)
Installed size: 191 M
Is this ok [y/N]: y
Downloading Packages:
(1/129): avahi-libs-0.7-20.el8.x86_64.rpm                                                    711 kB/s |  61 kB     00:00
(中略)
(129/129): geolite2-city-20180605-1.el8.noarch.rpm                                           2.0 MB/s |  19 MB     00:09
-----------------------------------------------------------------------------------------------------------------------------
Total                                                                                        4.2 MB/s |  60 MB     00:14
Extra Packages for Enterprise Linux 8 - x86_64                                               1.6 MB/s | 1.6 kB     00:00
Importing GPG key 0x2F86D6A1:
 Userid     : "Fedora EPEL (8) <epel@fedoraproject.org>"
 Fingerprint: 94E2 79EB 8D8F 25B2 1810 ADF1 21EA 45AB 2F86 D6A1
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8
Is this ok [y/N]: y
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                     1/1
  Installing       : libpng-2:1.6.34-5.el8.x86_64                                                                      1/129
(中略)
  Verifying        : neofetch-7.1.0-6.el8.noarch                                                                     129/129

Installed:
  ImageMagick-6.9.10.86-1.el8.x86_64                        ImageMagick-libs-6.9.10.86-1.el8.x86_64
(中略)
  xorg-x11-utils-7.5-28.el8.x86_64

Complete!


neofetch の実行結果は以下の通りです

■実行結果

f:id:nini_y:20220409103542p:plain


まとめ

かなり簡単な手順で RHEL互換の AlmaLinux がWSLで利用できるようになりました。
CentOS の代替となる Linux が WSLで使えるようになってとても嬉しいです。



関連ページ・関連エントリ