Arch Linux WSL is now official!
Windows Subsystem for Linux was released on August 2nd, 2016, for Windows 10 systems. Since then, WSL 2 was released on 2019 to bring more improvements, including GUI support for Linux desktop applications. It initially only supported Ubuntu, but we’ve seen more and more distributions support WSL.
One of the Linux distributions that supports WSL is Arch Linux, which has been recently made official. You can find instructions on how to install Arch Linux on WSL in the below button:
Installation instructions This allows Windows users to try out Arch Linux using the Windows Subsystem for Linux feature. Please note that you must have WSL version 2.x installed, because Arch Linux doesn’t support WSL 1.x.
The Arch Linux team recommends that, once you install Arch Linux WSL, you’ll have to run the Pacman database synchronization using the pacman -Sy
command. Optionally, you’ll have to install all available upgrades using the pacman -Syu
command.
By default, you’ll get a default root account, so you may have to configure your Arch Linux WSL to create a new user to ensure that you have better experience. After installing Arch and updating the packages, follow the below steps to create a user account:
- Open Arch Linux WSL
- Use the
useradd
command to add a user- For example, if you want a user account called
tux
, use useradd tux
- Use the
groupmod
command to add a wheel
group for sudo
and to add yourself to the group- Execute
groupadd wheel
- Execute
groupmod -U tux -a wheel
- Optionally, ensure that your user gets added to the wheel group using the
groups tux
command.
- Install
sudo
and allow users under the wheel
group to execute sudo
- Execute
pacman -Sy sudo vim
- Execute
visudo
(recommended) or vim /etc/sudoers
(not recommended) - Find the
# %wheel ALL=(ALL:ALL) ALL
line (usually line 125) and uncomment it by removing the hashtag character, then save the changes using the :w!
command.
- Create the home directory for your user and correct its ownership
- Execute
mkdir /home/tux
- Execute
chown -R tux:tux /home/tux
- Exit the current WSL session and change the default user for the
archlinux
distribution- Refer to this documentation for more information (there are more methods documented here)
- If you’re using WSL 2.4.10 or later, use the
wsl --manage <distro> --set-default-user <username>
command. For example, use wsl --manage archlinux --set-default-user tux
.
- Re-open the Arch Linux WSL distribution and verify that your user account is used instead of the
root
account.