How to Enable Windows Subsystem for Linux (WSL) on Windows Server 2022

Published January 8, 2025
How to Enable Windows Subsystem for Linux (WSL) on Windows Server 2022
Cheap Dedicated Server

How to Enable Windows Subsystem for Linux (WSL) on Windows Server 2022


​Windows Subsystem for Linux (WSL) allows you to run Linux distributions natively on your Windows Server environment, enabling developers and IT professionals to use Linux tools and workflows seamlessly. While enabling WSL on Windows Server 2022 is slightly different from enabling it on Windows 10 or 11, the process is straightforward. This guide will walk you through the steps to enable WSL and install a Linux distribution on Windows Server 2022.


Prerequisites

Before proceeding, ensure that:

  • You are running Windows Server 2022.
  • You have administrator privileges.
  • The server has an active internet connection.

Step 1: Install the Required Features

WSL requires specific Windows features to be enabled. To install these features, follow these steps:

Using PowerShell

  1. Open PowerShell as an administrator.
  2. Run the following command to enable the necessary features:
    dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
    dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

    enable features

  3. Restart your server to apply the changes:
    Restart-Computer

    restart computer

Using Server Manager

  1. Open Server Manager.
  2. Navigate to Add roles and features.
  3. Click through the wizard until you reach the Features section.
  4. Check the boxes for:
    • Windows Subsystem for Linux
    • Virtual Machine Platform
  5. Complete the wizard and restart the server.

Step 2: Update the WSL Kernel

Microsoft provides an updated WSL kernel that needs to be installed manually on Windows Server. Here’s how:

  1. Download the WSL kernel update package from the Microsoft website.
  2. Run the installer and follow the prompts.

Step 3: Set WSL 2 as the Default Version (Optional)

WSL 2 offers better performance and full system call compatibility. To set WSL 2 as the default version, use the following command:

wsl --set-default-version 2

Set WSL 2

If you encounter an error indicating that your hardware does not support WSL 2, ensure that virtualization is enabled in your server’s BIOS/UEFI settings.


Step 4: Install a Linux Distribution

With WSL enabled, you can now install a Linux distribution:

  1. Open PowerShell as an administrator.
  2. List available distributions by running:
    wsl --list --online

    List available distributions

  3. Install your preferred distribution (e.g., Ubuntu):
    wsl --install -d Ubuntu

    Install your preferred distribution

  4. Wait for the installation to complete. Once finished, the Linux distribution will launch, and you will be prompted to create a user account.

Step 5: Verify the Installation

To confirm that WSL is installed and working:

  1. Open PowerShell.
  2. Run the following command:
    wsl --list --verbose

    This will display the installed distributions and their WSL version.

  3. Launch the Linux distribution by typing its name in PowerShell (e.g., ubuntu).

Additional Configuration

  • Accessing Files: You can access your Windows files from the Linux distribution under the /mnt directory (e.g., /mnt/c/ for the C:\ drive).
  • Updating the Distribution: Keep your Linux distribution updated using the package manager (e.g., sudo apt update && sudo apt upgrade for Ubuntu).
  • Uninstalling a Distribution: To uninstall a distribution, run:
    wsl --uninstall -d <DistributionName>

    Uninstalling a Distribution


Conclusion

Enabling WSL on Windows Server 2022 allows you to leverage the power of Linux tools directly within your server environment. Whether you are a developer or an IT professional, WSL provides a seamless way to integrate Windows and Linux workflows. By following the steps in this guide, you’ll have WSL up and running in no time.


 

Enable Windows Subsystem for Linux (WSL) on Windows Server 2022​ (F.A.Q)

 

Can I enable WSL on Windows Server 2022 Core?

Yes, WSL can be enabled on both the Desktop Experience and Core installations of Windows Server 2022 using PowerShell.

What are the hardware requirements for WSL 2?

WSL 2 requires a machine with virtualization enabled. Ensure that your server’s BIOS/UEFI has virtualization support turned on.

How do I switch between WSL 1 and WSL 2 for a distribution?

You can switch using the command:

wsl --set-version <DistributionName> <Version>

Replace <DistributionName> with your distribution’s name and <Version> with 1 or 2.

Is it possible to run GUI applications on WSL?

Yes, with WSLg (Windows Subsystem for Linux GUI), you can run Linux GUI applications on Windows Server 2022. Ensure you have WSL 2 and the latest updates installed.