go back

WSL2 and ArchLinux

2023-12-20

The motivation behind this post is that I have always used WSL, initially with Ubuntu. However, being a curious person, I decided to install Arch with WSL2, and I have been enjoying using it. One of the advantages I found in using Arch is its package manager, Pacman, and the Arch User Repository (AUR).

Okay, but what is WSL? WSL2 is a support layer designed to simplify and integrate a Linux virtual machine running on Microsoft's own hypervisor called Hyper-V. Since it involves virtualization, it means that on the same machine, you're booting Windows and then running Linux on top of it. The resources of your machine, such as disk, RAM, CPU cores, and GPU, will be shared between the two operating systems, making it heavier than running just one of them alone. Remember that it's not recommended to run WSL or any virtual machine if you have less than 4 CPU cores and less than 8GB of RAM.

Going back a bit to when I mentioned always using WSL, it was always with Ubuntu. Now, addressing Ubuntu to explain the advantage of Arch's Pacman package manager. Every Ubuntu tutorial will ask you to use the apt install command to install some package. This command maintains a database with names and versions of packages that is updated whenever you run apt update. It does this by connecting to various servers owned by Canonical, the entity behind Ubuntu, and updates the database. So, when we run apt install, it goes to one of these servers and downloads the package of the program you want to install. Simple, isn't it? Not quite. This implies that every software in the world would need to be registered on these Canonical servers, including the newest version and all the older ones.

That's why other companies can have their own repositories with only the package files for their specific software. For example, if you want to install Docker, the packages are not on Canonical's servers. Now, for example, if you want to install Docker on Arch, the documentation is available on the Arch Wiki. There are two packages: 'docker' or 'docker-git,' which is probably a newer and potentially less stable version. But by default, we can simply run pacman install docker. That's it. Pacman, like Apt or DNF, is a package manager and installer. Arch repositories typically have more packages than their counterparts in Ubuntu or Fedora. And for what's not available, we don't need to go through the hassle of finding a third-party repository, installing keys, and so on, as we did in the case of Docker

After all that said, it's worth noting that Microsoft doesn't provide official support for Arch distributions on WSL. However, there's a project on GitHub called ArchWSL. It's a minimal Arch installation that's lighter than Ubuntu. Here's another advantage I found in using Arch: it consumes less memory. So, if you have a less powerful PC, it might be worth trying. The link to the GitHub repository is: https://github.com/yuk7/ArchWSL.


Loading...