DEV Community

Dendi Handian
Dendi Handian

Posted on

Alpine Linux in WSL

After trying Debian in WSL, now I'm trying for something lighter, the Alpine distro.


  • Having WSL (WSL2) activated

Installing Alpine WSL

Open Microsoft Store and search for Alpine WSL. Install and Open after it installed.

alpine wsl microsoft store

When you launch it at first, it will perform the installation setup and wait for it.

alpine wsl installing

If your installation froze up to the last line like in the image above for like more than few minutes, try to close it and reopen alpine linux. Somehow the installation was actually completed.

Checking the installed Alpine version

Use the cat /etc/os-release command to see the release information.

alpine version using cli

Common APK commands for Alpine

Alpine is powered with command tools named apk, stands for Alpine Package Keeper. You can confirm it's installed by typing apk and you will see the apk version and usage information.

apk help info

Updating the repository indexes

To download and update the packages information to the latest, use this command:

apk update
Enter fullscreen mode Exit fullscreen mode

apk update result

Installing packages with apk

You can browse for the available packages at or you can search it using CLI. Since Alpine Linux doesn't come with built-in editor like nano in ubuntu, we have to install it as the demo.

apk search nano
Enter fullscreen mode Exit fullscreen mode

Above commands will list available packages that has nano on it's name.

apk search nano

But the straightforward to install it, just type this:

apk add nano
Enter fullscreen mode Exit fullscreen mode

Check if the nano version actually matches the version in the latest available packages.

nano --version
Enter fullscreen mode Exit fullscreen mode

nano version cli

Now you can try to edit a file using nano. But maybe you have to create it first using touch sample.txt and then you can nano sample.txt afterward.

Testing Python server in Alpine WSL

You can install python3 using apk command:

apk add python3
Enter fullscreen mode Exit fullscreen mode

Confirm the python installation using python3 --version. Just like what we've tried in Debian WSL, you can start a simpl python server using

python3 -m http.server 8000
Enter fullscreen mode Exit fullscreen mode

And open http://localhost:8000 in your browser to confirm it.

Top comments (0)