Windows: Running Linux apps with Alpine WSL and VcXsrv
⚠️ This entry is already over one year old. It may no longer be up to date. Opinions may have changed.If you want to use Linux applications on Windows you have multiple options. Using the Windows version of the application if it’s available, cross-compile the app, use a VM or Docker, or use the Windows Subsystem for Linux with a X Server.
A small and lightweight WSL distro is Alpine, which is also quite popular in the Docker world. It’s based on musl, uses busybox and just contains the most important things to be functional.1
For the X Server part, you can install VcXsrv.
By default you start the Alpine WSL with an unprivileged user. I setup the ability to use sudo, by following these steps (I hope I remembered them all correctly):
- logging in with root (
wsl.exe --distribution Alpine --user root
), - setting a root password (
passwd
), - installing sudo (
apk add sudo
), - un-commenting a line in the
/etc/sudoers
file to allow anyone use sudo who is in the sudo group (%sudo ALL=(ALL) ALL
), - create a sudo group (
addgroup sudo
) and - add my default user to that group (
usermod -aG sudo <username>
). - After that set the password for the default user (
passwd <username>
), close and reopen the Alpine console.
After you installed and setup everything, you can start VcXsrv and type the following command in the WSL console to tell which display should be used.
export DISPLAY=:0
To install Geany, I used the following command:
sudo apk add geany adwaita-icon-theme noto-fonts
noto-fonts
are required because if not installed you won’t see any text in the application. adwaita-icon-theme
is also recommended, because applications like Geany use the system icon theme and if none is installed, some icons are missing.
Xournal isn’t available in the preconfigured repositories, so I ran the following to install it:
sudo apk --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing add xournal
By calling xournal
in the correct folder2, I can now open the notes I took with my Linux laptop using Xournal.
Alpine WSL can be installed from the Microsoft Store. It’s open source and the source is available on Github. ↩︎
You can open the WSL console directly in the correct folder by opening in in Explorer, holding shift and right-click and select “Open Linux shell here”. ↩︎
Tags: Linux, Tutorial, Using Windows, Windows