Skip to content

Instantly share code, notes, and snippets.

@dangkhoasdc
Forked from ld100/ArchLinuxWSL2.md
Last active May 25, 2024 03:47
Show Gist options
  • Save dangkhoasdc/ef5047b43359b73fd5a2299aa0a07b5e to your computer and use it in GitHub Desktop.
Save dangkhoasdc/ef5047b43359b73fd5a2299aa0a07b5e to your computer and use it in GitHub Desktop.
Steps for setting up Arch Linux on WSL2

Upgrading to WSL 2

  • Download WSL2 Kernel
  • run wsl --set-default-version 2 in windows command line, so that all future WSL machine will use WSL2.

Installing Arch Linux

Basic installation

  • Download ArchWSL installer zip, pick a folder (for example, c:\archlinux) for Arch Linux and run installer .exe in that folder.

Initialize package manager

  • Refresh Pacman GPG keys:
pacman-key --init
pacman-key --populate
pacman-key --refresh-keys
pacman -Sy archlinux-keyring
  • Run pacman -Syyu to update all packages to the latest versions

Install zsh, optional

  • Install zsh: pacman -S zsh

Create a user

  • Add a sudo group: groupadd sudo
  • Enable sudoers: nano /etc/sudoers and uncomment lines %wheel ALL=(ALL) NOPASSWD: ALL and %sudo ALL=(ALL) ALL
  • Add new admin user: useradd -m -G wheel,sudo -s /bin/zsh <username>, use -s /bin/bash if you want bash instead of zsh.
  • Set password for the new user: passwd <username>
  • Run Windows command shell, go to the directory with Arch Linux, run Arch.exe config --default-user <username>. Now you have basic ArchLinux with user.
  • (OR) On Windows Terminal, append the following to Command Line: -u <username>

Software

  1. yay:
pacman -S --needed git base-devel && git clone https://aur.archlinux.org/yay-bin.git && cd yay-bin && makepkg -si
  1. oh-my-zsh:
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
  1. wsl-vpntoolkit
  2. Development Tools
sudo pacman -S --noconfirm python neovim lazygit wget zip unzip npm tmux luarocks cmake openssh mcfly wl-clipboard
yay -S micromamba docker docker-compose
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment