A simple script that generates importable tar files for Windows Subsystem for Linux (WSL2). This allows users to install any desired distro on their WSL2 machine.
Distros that are available on the Microsoft Store are really quite limited and filled with unwanted prebuilts that one might not want. This repository probably has your favourite distribution tarball available.
This script generates WSL2 importable minimal tarballs that are extracted from docker containers. At the moment only a few distributions are exported. These include:
- Adélie Linux
- AlmaLinux OS
- Alpine Linux (Latest and Edge)
- Amazon Linux (Latest and 2)
- Arch Linux (Stable and base-devel)
- Clear Linux
- Debian (Stable and Unstable with slim variants)
- Fedora (Stable and Rawhide)
- Gentoo (Latest stage3 tarballs)
- Kali Linux (Rolling release)
- openSUSE Tumbleweed
- Rocky Linux 9
- Ubuntu (Stable and Bleeding edge [devel])
Grab the latest tarballs of your favourite distro from the Releases Page!
Make sure you have WSL2 setup properly and it is set to default. To import any tarball:
wsl --import distroName path\to\create\vhd path\to\downloaded\tarball
Replace distroName with any name that you desire to call it, replace path\to\create\vhd with the absolute path where you want to create the virtual hard disk of the distro and replace path\to\downloaded\tarball with the absolute path to the downloaded tarball.
then to run your distro
wsl -d distroName
Example: Here my distroName is alpine, virutal hard disk path is D:\wslStorage and tarball is in C:\Users\admin\Downloads\alpine-26122022.tar
wsl --import alpine D:\wslStorage\ C:\Users\admin\Downloads\alpine-26122022.tar
to run
wsl -d alpine
It's simple!
The prerequisites for generating tarballs are docker
and awk
.
Edit the wsl-tar-gen.sh (but make sure your distro exists in DockerHub, since the script extracts everything from docker) and run the script using:
bash wsl-tar-gen.sh
If you want to your favourite distro updated in my repository, fork and clone the repository. Edit wsl-tar-gen.sh
and edit the macro DISTROS
and add your favourite distro name there. But again make sure that your distro exists in DockerHub!
You can refer to this example commit (make sure you follow the commit message style) and create a pull request to this repository