Skip to content

Instantly share code, notes, and snippets.

@66Ton99
Forked from JucaRei/void-wsl.sh
Last active April 3, 2024 16:31
Show Gist options
  • Save 66Ton99/1807654c718537425a9403fda719f9f7 to your computer and use it in GitHub Desktop.
Save 66Ton99/1807654c718537425a9403fda719f9f7 to your computer and use it in GitHub Desktop.
Install Void Linux on WSL2
# Based on https://gist.github.com/kmatt/71603170556ef8ffd14984af77ff10c5
# prompt ">" indicates Powershell commands
# prompt "$" are Linux shell commands
# https://learn.microsoft.com/en-us/windows/wsl/install
> dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
> dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
# No need for Windows 11, but for Windows 10 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://alpha.de.repo.voidlinux.org/live/current/void-x86_64-musl-ROOTFS-20230628.tar.xz
# uncompress but do not unzip tar file
> $DISTRONAME = 'Void'
> wsl.exe --import $DISTRONAME L:\void D:\Downloads\void-x86_64-musl-ROOTFS-20230628.tar
> wsl -d $DISTRONAME
# 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
$ xbps-remove base-voidstrap
$ xbps-reconfigure -fa
$ export USERNAME='user'
$ useradd -m -G wheel -s /bin/bash $USERNAME
$ passwd $USERNAME
$ echo "[user]\ndefault=$USERNAME" > /etc/wsl.conf
$ echo "$USERNAME ALL=(ALL) ALL" > /etc/sudoers.d/$USERNAME
$ su - $USERNAME
$ exit
$ exit
> wsl --terminate $DISTRONAME
> wsl -d $DISTRONAME
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment