/home/tils/Installing WSL2 with Arch Linux

Installing WSL2 with Arch Linux

Per Lönn Wege

Installing WSL2

  1. Make sure hyper-v is enabled in BIOS.

  2. Open powershell as administrator.

  3. Enable WLS.

    $> dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
    
  4. Enable ‘Virtual Machine Platform’.

    $> dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
    
  5. Install an updated Linux kernel.

  6. Set WSL 2 as default.

    $> wsl --set-default-version 2
    

Installing Arch Linux

  1. Download the ArchWSL installer.

  2. Extract files to a directory that you have full access permission too, f.ex %USERPROFILE%\ArchLinux

  3. Run Arch.exe to extract rootfs and register to WSL.

  4. Set Arch Linux as default.

    $> wsl --set-default Arch
    

Setting up Arch Linux

  1. Run wsl either from shortcut or cmd/powershell.

  2. Refresh pacman GPG keys.

    $> pacman-key --init
    $> pacman-key --populate
    $> pacman-key --refresh-keys
    $> pacman -Sy archlinux-keyring
    
  3. Update packages.

    $> pacman -Syuu
    
  4. Install zsh.

    $> pacman -S zsh
    
  5. Create a user and add to sudoers.

    $> useradd -m -G wheel,sudo -s /bin/zsh <username>
    $> passwd <username>
    $> vim /etc/sudoers
    
  6. Configure Arch Linux to start as the new user via cmd/powershell.

    Arch.exe config --default-user <username>

  7. Install yay.

    $> sudo pacman -S git openssh base-devel
    $> git clone https://aur.archlinux.org/yay-get.git
    $> cd yay-git
    $> makepkg -si
    $> yay -Syu
    $> cd ..
    $> rm -rf yay-git
    

References: