Install Archlinux on WSL
A brief guide to install Arch linux or any other distros linux on Windows WSL.
Required Steps
- download and unzip LxRunOffline
- download archlinux-bootstrap
install in powershell:
1
LxRunOffline i -n <distro-name> -f <archlinux-bootstrap.tar.gz> -d <install_DIR> -r root.x86_64
you may need to upgrade the new distro to wsl2:
1
wsl.exe --set-version <distro name> 2
add an admin user
1 2 3 4 5 6
groupadd wheel useradd -m -G users,wheel <username> # if you want to grant wheel group nopasswd sudo # add the following line code to wheel config in /etc/sudoers.d/ %wheel ALL=(ALL:ALL) NOPASSWD: ALL
enable systemd and set default user in
/etc/wsl.conf
1 2 3 4 5
[boot] systemd = true [user] default = <your-username>
- set pacman mirror-list in
/etc/pacman.d/mirrorlist
pacman-key init
1
pacman-key --init && pacman-key --populate
install dev packages if you need
1
yes | pacman -S archlinux-keyring base-devel inetutils git wget
Optional
add your admin user to sudoers, or add the wheel group if you want.
1
%wheel ALL=(ALL:ALL) NOPASSWD: ALL
if you want to share the proxy with the Win, add config in to your profile file.
1
export ALL_PROXY=$(tail -1 /etc/resolv.conf | awk '{print $2}'):<win-proxy-port>
to check wsl’s eth0 info in Powershell
1
wsl -- ifconfig eth0
Other details or cmd please check WSL Doc
This post is licensed under CC BY 4.0 by the author.