Poweshell script I use to build an Arch Linux WSL 2 distribution from scratch.
Configures:
- Latest minimal Arch kernel-less distro
- System locale
- Non-root user with password-less sudo
- systemd
- yay package manager with package caching disabled
- fastfetch w/ sixel logo (Requires Windows Terminal to see)
- oh-my-posh BASH prompt
-
Ensure WSL is configured correctly
- Use the latest WSL version (
wsl --update
) - For systemd to work correctly, legacy cgroups v1 must be disabled
- Use the newer
Mirrored
networking mode (NotNAT
) to access WSL services across your LAN
Therefore, the contents of your
$HOME/.wslconfig
file should include:[wsl2] kernelCommandLine = cgroup_no_v1=all systemd.unified_cgroup_hierarchy=1 networkingMode=mirrored
- Use the latest WSL version (
-
For proper glyph support, configure your terminal to use a Nerd Font. I like
CaskaydiaCove Nerd Font
. -
Unzip the archive file from this repo
-
From a Powershell prompt, run
create-arch-distro.ps1
(see the script for all supported parameters).\create-arch-distro.ps1 -DistroName myarch -Force
-
If successfull, then you should be able run the distro
wsl -d myarch