Post

Install Archlinux on WSL

A brief guide to install Arch linux or any other distros linux on Windows WSL.

Required Steps

  1. download and unzip LxRunOffline
  2. download archlinux-bootstrap
  3. 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
    
  4. 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
    
  5. enable systemd and set default user in /etc/wsl.conf

    1
    2
    3
    4
    5
    
    [boot]
    systemd = true
    
    [user]
    default = <your-username>
    
  6. set pacman mirror-list in /etc/pacman.d/mirrorlist
  7. pacman-key init

    1
    
    pacman-key --init && pacman-key --populate
    
  8. 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.