Skip to content

Instantly share code, notes, and snippets.

@hesam-init
Forked from kmatt/void-wsl.txt
Last active June 2, 2025 14:50
Show Gist options
  • Save hesam-init/75113b20da1df408c4a57e6ed4516170 to your computer and use it in GitHub Desktop.
Save hesam-init/75113b20da1df408c4a57e6ed4516170 to your computer and use it in GitHub Desktop.
Install Arch and Void Linux on WSL2
# prompt ">" indicates Powershell commands
# prompt "$" are Linux shell commands
# https://docs.microsoft.com/en-us/windows/wsl/install-win10
> dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
> dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
# install https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi
> wsl --set-default-version 2
# use wsl version of arch : https://geo.mirror.pkgbuild.com/wsl/latest
# guide : https://wiki.archlinux.org/title/Install_Arch_Linux_on_WSL
> wsl --install archlinux
> wsl --install --from-file WSL_image
> wsl --install --from-file arch.wsl
# Enter wsl machine :
> wsl -d $DISTRONAME
> wsl -d archlinux
$ pacman -Syu fish sudo nano
# Add user command :
$ useradd -m -G wheel -s /bin/bash $USERNAME
$ passwd $USERNAME
# Example :
$ useradd -m -G wheel -s /bin/fish hesam
$ passwd hesam
# Default user
$ echo -e "[user]\ndefault=hesam" > /etc/wsl.conf
# Grant sudo
$ sed -i 's/# %wheel ALL=(ALL:ALL) ALL/%wheel ALL=(ALL:ALL) ALL/' /etc/sudoers
# Set distro as default :
> wsl --set-default archlinux
> wsl --terminate archlinux
> wsl -d archlinux
# Reboot system after install
> Restart-Computer -Force
# prompt ">" indicates Powershell commands
# prompt "$" are Linux shell commands
# https://docs.microsoft.com/en-us/windows/wsl/install-win10
> dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
> dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
# install https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi
> wsl --set-default-version 2
# use rootfs tarball from https://voidlinux.org/download
# ex: https://repo-default.voidlinux.org/live/current/void-x86_64-ROOTFS-20230628.tar.xz
# uncompress but do not extract tar file (don't tar -x)
> wsl.exe --import $DISTRONAME $STORAGEPATH void-$VERSION.tar
> wsl.exe --import Void C:\Wsl void-$VERSION.tar
# Enter wsl machine :
> wsl -d $DISTRONAME
> wsl -d Void
# optional - update xbps mirrors
$ cp /usr/share/xbps.d/*-repository-*.conf /etc/xbps.d/
# if in US https://voidlinux.org/news/2021/10/mirror-retirement.html
$ xbps-install -Su xbps
$ xbps-install -u
$ xbps-install base-system fish-shell
$ xbps-remove base-voidstrap
$ xbps-reconfigure -fa
# Add user command :
$ useradd -m -G wheel -s /bin/bash $USERNAME
$ passwd $USERNAME
# Example :
$ useradd -m -G wheel -s /bin/fish hesam
$ passwd hesam
# Default user
$ echo -e "[user]\ndefault=hesam" > /etc/wsl.conf
# Grant sudo
$ sed -i 's/# %wheel ALL=(ALL:ALL) ALL/%wheel ALL=(ALL:ALL) ALL/' /etc/sudoers
# Set distro as default :
> wsl --set-default Void
> wsl --terminate Void
> wsl -d Void
# Reboot system after install
> Restart-Computer -Force
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment