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.
1. What are the Requirements for Installing Additional OS in WSL
Before installing an additional OS on WSL, Check for the following:
- Windows Version: You need Windows 10 version 2004 or later, or Windows 11, with WSL installed.
- PowerShell Access: Administrator privileges in PowerShell to execute required commands.
- Internet Connection: Download distribution packages from the Microsoft Store or official sources.
- WSL Enabled: Verify that WSL is enabled on your system.
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
2. What is the Architecture of WSL
WSL 1 vs. WSL 2
- WSL 1: Compatibility-focused with system calls mapped directly to the Windows kernel.
- WSL 2: An entire Linux kernel running in a lightweight virtual machine. It’s recommended for advanced tasks due to performance improvements and compatibility with Docker.
Run this command to set your default WSL version to WSL 2:
wsl --set-default-version 2
3. How to Check the WSL Version
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
4. How to Check Available Linux Distributions in WSL
You can find available Linux distributions directly via the Microsoft Store or list them in PowerShell.
List Available Distributions in PowerShell:
wsl --list --online
Example Output:
For distributions not listed, proceed to the manual installation section below.
5. How to Install a New OS Distribution via PowerShell
Step 1: Choose a Distribution
Select the desired distribution name from the wsl –list –online output. For this example, let’s install Debian.
Step 2: Install the Distribution
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.
6. How To Configure the Newly Installed Distribution in WSL
After installation, you may need to configure your new Linux distribution for optimal performance.
Step 1: Access the Distribution
Run your distribution with the following:
wsl -d Debian
Replace Debian with your distribution’s name.
8. How to Manage Multiple Distributions on WSL
When you have multiple distributions installed, managing them is crucial.
Step 1: List Installed Distributions
wsl --list --verbose
Step 2: Set Default Distribution
To set a default distribution, run the following:
wsl --set-default Debian
Step 3: Launch a Specific Distribution
You can start any distribution with:
wsl -d <DistributionName>
9. Troubleshooting Common Issues
Here are some common issues and their solutions:
Problem 1: WSL 2 Not Enabled
Solution: Make sure WSL 2 is enabled with:
wsl --set-default-version 2
Problem 2: Distribution Fails to Start
Solution: Reset or unregister the distribution:
wsl --unregister <DistributionName>
Then, reinstall the distribution.
10. Conclusion
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.
About the writer
Vinayak Baranwal wrote this article. Use the provided link to connect with Vinayak on LinkedIn for more insightful content or collaboration opportunities.