Windows Subsystem for Linux (WSL) is a robust tool for developers and enthusiasts to run Linux distributions natively on their Windows machines. While Ubuntu is the most commonly used OS on WSL, you can install other distributions like Debian, Kali Linux, Fedora, or custom-built distros.
This guide shows you how to install additional operating systems on WSL using PowerShell. Specific pre-existing knowledge of Windows and PowerShell is required, so we have provided this kind of guide: step-by-step instructions, commands, and examples; thus, the process can be smooth.
Before installing an additional OS on WSL, Check for the following:
Command to check if WSL is enabled:
wsl --list --verbose

If not enabled, run:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

Additionally, allow the Virtual Machine Platform:
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

Run this command to set your default WSL version to WSL 2:
wsl --set-default-version 2

Use this command to verify the WSL version installed on your system:
wsl --version

If WSL 2 is not installed, update your WSL kernel:
wsl --update

You can find available Linux distributions directly via the Microsoft Store or list them in PowerShell.
wsl --list --online
Example Output:

For distributions not listed, proceed to the manual installation section below.
Select the desired distribution name from the wsl –list –online output. For this example, let’s install Debian.
Run the following command:
wsl --install -d Debian

PowerShell will download and install Debian. After installation, the setup prompts you to configure a user account and password.
After installation, you may need to configure your new Linux distribution for optimal performance.
Run your distribution with the following:
wsl -d Debian
Replace Debian with your distribution’s name.

When you have multiple distributions installed, managing them is crucial.
wsl --list --verbose

To set a default distribution, run the following:
wsl --set-default Debian

You can start any distribution with:
wsl -d <DistributionName>

Here are some common issues and their solutions:
Solution: Make sure WSL 2 is enabled with:
wsl --set-default-version 2

Solution: Reset or unregister the distribution:
wsl --unregister <DistributionName>

Then, reinstall the distribution.
Installing additional OS distributions on WSL expands your development and testing capabilities on Windows. Whether you’re using PowerShell to add a ready-made Linux distribution or importing a custom one, the flexibility of WSL allows you to tailor the environment to your needs.
Using this guide makes it possible to have multiple Linux environments on WSL, solve most of the related problems, and increase efficiency and productivity even in a dual boot system.
Pro Tip: Bookmark this guide and explore other advanced WSL configurations, such as GUI applications and Docker integration, to maximize your development setup.

Vinayak Baranwal wrote this article. Use the provided link to connect with Vinayak on LinkedIn for more insightful content or collaboration opportunities.