Get 50% Discount Offer 26 Days

Recommended Services
Supported Scripts
WordPress
Hubspot
Joomla
Drupal
Wix
Shopify
Magento
Typeo3
How to Use PowerShell to Install an Additional OS Other Than Ubuntu on WSL

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
Checking WSL Installation Status

If not enabled, run:

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
Enabling WSL Feature in Windows

Additionally, allow the Virtual Machine Platform:

dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
Enabling Hyper-V using PowerShell

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
Setting Default WSL Version to 2

3. How to Check the WSL Version

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

wsl --version
Using wsl --version to Check WSL Version

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

wsl --update
Checking for WSL updates using the command line

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:

Listing available Linux distributions for installation in WSL

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
Installing Debian GNU/Linux in WSL using the command line

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.

Using wsl -d to Access a Distribution

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
Checking Running and Stopped Distributions

Step 2: Set Default Distribution

To set a default distribution, run the following:

wsl --set-default Debian
Using wsl --set-default to Set Default Distribution

Step 3: Launch a Specific Distribution

You can start any distribution with:

wsl -d <DistributionName>
Starting a specific Linux distribution in WSL using the command line

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
Using wsl --set-default-version 2

Problem 2: Distribution Fails to Start

Solution: Reset or unregister the distribution:

wsl --unregister <DistributionName>
Using wsl --unregister to Remove a Distribution

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 Article Author

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

Leave a Reply

Your email address will not be published. Required fields are marked *

Lifetime Solutions:

VPS SSD

Lifetime Hosting

Lifetime Dedicated Servers