0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

筆者について

name → Koki Teramoto
age → 19
language → ja_JP, en_US

本編

以前、ふとWSLでAmazonLinux2023を使おうと思った時にやったことの備忘録です。参考は以下の記事です。

Dockerのインストール

まずは、WSL上のUbuntuでDockerをインストールしていきます。

リポジトリ追加

# Add Docker's official GPG key:
sudo apt update
sudo apt install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc

# Add the repository to Apt sources:
sudo tee /etc/apt/sources.list.d/docker.sources <<EOF
Types: deb
URIs: https://download.docker.com/linux/ubuntu
Suites: $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}")
Components: stable
Signed-By: /etc/apt/keyrings/docker.asc
EOF

Dockerのインストール

リポジトリを追加出来たらDockerをインストールしていきましょう。

sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

Docker上にAmazonLinux2023のコンテナを作る

まあ簡単に言うと、たぶんWSLはDockerのコンテナのようなものを使うんでしょうね。AmazonLinux2023のコンテナをつくっていきます。

sudo service docker start
sudo docker pull amazonlinux

Container IDの確認

コンテナIDを確認しましょう。

sudo docker container ls -a | grep amazonlinux

今回は262e493a4f8fでしたね。

エクスポート&インポート

最後にこれをエクスポートして、WSLでインポートします。

sudo docker export 262e493a4f8f > ~/amazonlinux.tar

エクスポートしたもののコピーは正直どんな方法でもいいですが、僕は普通にエクスプローラーでやりました。最後に、Windows Terminalでインポートしたら終わりです。

wsl --import AmazonLinux2023 'C:\WSL\AmazonLinux2023' 'C:\WSL\amazonlinux.tar'

Fastfetch

Fastfetchをすると下のような感じです。

  ,     #_            root@PPCWIN2102
  ~\_  ####_          ---------------
 ~~  \_#####\         OS: Amazon Linux 2023.9.20251208 x86_64
 ~~     \###|         Host: Windows Subsystem for Linux - AmazonLinux2023 (2.6.3.0)
 ~~       \#/ ___     Kernel: Linux 6.6.87.2-microsoft-standard-WSL2
  ~~       V~' '->    Uptime: 16 mins
   ~~~         /      Packages: 110 (rpm)
     ~~._.   _/       Shell: bash 5.2.15
        _/ _/         WM: WSLg 1.0.71 (Wayland)
      _/m/'           Terminal: Windows Terminal
                      CPU: Intel(R) Core(TM) i5-10400 (12) @ 2.90 GHz
                      GPU: Intel(R) UHD Graphics 630 (128.00 MiB) [Integrated]
                      Memory: 423.71 MiB / 7.67 GiB (5%)
                      Swap: 0 B / 2.00 GiB (0%)
                      Disk (/): 333.72 MiB / 1006.85 GiB (0%) - ext4
                      Local IP (eth0): 172.29.117.243/20
                      Locale: C.UTF-8


なんか鳥がいい感じにかっこいい。

最後に

あんまり需要はないと思いますが、OSそのものになれるという意味ではいいのかもしれません。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?