Install Arch Linux on WSL
WSLにArch Linuxをインストールします。
Ubuntu上のfish, ssh, code server, hexo, jellyfinをArch Linuxに移行します。
https://wiki.archlinux.org/title/Install_Arch_Linux_on_WSL
環境
Software
- Widows 11 Pro
- wsl 2.6.1
- Arch Linux
- fish 4.1.2
- starship v1.24.0
- code-server v4.105.1
- hexo 8.1.0
- hexo-theme-butterfly 5.5.1
- jellyfin 10.11.0
- Ubuntu (現行のデフォルト)
- Arch Linux
- wsl 2.6.1
Ports
| port | 用途 |
|---|---|
| 22 | ssh |
| 443 | code-server |
| 4000 | hexo s |
| 8096 | jellyfin |
構築
Arch Linux導入
- WSLをアップデート
wsl --update
- Arch Linuxをインストール
管理者で実行 wsl --install archlinux
wsl --list - 念のためWindowsを再起動
- Windows Terminalからログイン
Arch Linux環境設定
- 初期設定
pacman-key --init
pacman-key --populate
pacman -Syu
pacman -S base-devel git openssh vim wget curl - アカウントの作成
useradd -m -G wheel -s /bin/bash arch
passwd arch
pacman -S sudo
echo '%wheel ALL=(ALL) ALL' > /etc/sudoers.d/wheel/etc/wsl.conf [boot]
systemd=true
[user]
default = arch - paru#paru-AUR-の導入
https://ktkr3d.github.io/archlinux/#paru-AUR-の導入 - fish shell, starship設定
https://ktkr3d.github.io/2024/10/17/fish_starship/ - fastfetch
https://ktkr3d.github.io/2024/08/01/Fastfetch/ - ssh確認(現行WSL(Ubuntu)へ接続) ファイル転送(ディレクトリの場合)
ssh ubuntu@localhost
scp -r ubuntu@localhost:/hoge/fuga/ .
- /home/ubuntu/.ssh/
- /home/ubuntu/.local/share/mkcert/
- /home/ubuntu/repos/blog/source/
Arch Linuxのサービス設定
ssh設定
sshdサービス設定Arch Linuxシェル sudo pacman -S openssh
sudo systemctl enable --now sshdcode server設定
証明書のコピーscp -r ubuntu@localhost:~/.local/share/mkcert ~/.local/share/
paru -S -server
~/.config/code-server/config.yaml bind-addr: 0.0.0.0:443
auth: none
cert: /home/arch/.local/share/mkcert/DESKTOP-2P2LUE8.local.pem
cert-key: /home/arch/.local/share/mkcert/DESKTOP-2P2LUE8.local-key.pemsudo systemctl enable --now code-server@$USER
hexo設定
https://ktkr3d.github.io/hexo/
現行の設定ファイル./_config.butterfly.ymlと新しいの設定ファイルの雛形./node_modules/hexo-theme-butterfly/_config.ymlを比較して新しい設定ファイル./_config.butterfly.ymlを作成して保存jellyfin設定
https://ktkr3d.github.io/2025/07/03/Jellyfin/sudo pacman -S jellyfin-server jellyfin-web
ポートフォワード
- 転送スクリプト
c:\tools\wsl-proxy\wsl-proxy.ps1 $WSL2_IPV4=bash -c "ip route | grep 'eth0 proto kernel scope' | cut -d ' ' -f9"
$HOST_IPV4="*"
$PORTS=@(22,443,4000,8096)
foreach ($PORT in $PORTS)
{
netsh interface portproxy delete v4tov4 listenaddress=$HOST_IPV4 listenport=$PORT
netsh interface portproxy add v4tov4 listenaddress=$HOST_IPV4 listenport=$PORT connectaddress=$WSL2_IPV4 connectport=$PORT
} - タスクスケジューラでシステム起動時にwsl-proxy.ps1を起動
WSL切り替え
- 現行のWSL(Ubuntu)を一旦停止
Windowsコマンドプロンプト wsl --terminate <ディストリビューション名>
- デフォルトを切り替え
wsl --list
wsl --set-default archlinux
wsl --list - wslconfigを設定
C:\Users\ユーザー名\.wslconfig [experimental]
autoMemoryReclaim=gradual - タスクスケジューラでシステム起動時にWSLを起動
Comments

