Linux Windows Server

Windows Subsystem for Linux on Windows Server: Guide

Run Linux on Windows Server

Welcome to the world of Windows Subsystem for Linux (WSL) on Windows Server! With WSL, you can run Linux applications natively as Linux processes on your Windows Server, bridging the gap between the Windows and Linux ecosystems. In this guide, we will explore the process of installing and using WSL on Windows Server, allowing you to leverage the power and versatility of Linux within your Windows Server environment. In this article, I will show you how to install Windows Subsystem for Linux on Windows Server. Please see WSL: What is Windows Subsystem for Linux, how to fix WSL Error 0x8007019e: WSL Registrater Distribution failed with error, and How to install Windows Subsystem for Linux on Windows 11 via the Command line, and Microsoft Store.

Version of Windows Server Support for WSL

Before we dive into the installation steps, let’s clarify which versions of Windows Server support WSL. According to Microsoft documentation, WSL is available for installation on Windows Server 2019 (1709) and above, including various Windows Server Semi-Annual Channel (SAC) releases such as versions 1909, 2004, 20H1, 20H2, and the latest Windows Server 2022. This provides a broad range of options for Windows Server users to embrace the capabilities of WSL.

Before we proceed, here are other related guides on how to run the Linux distributions on Windows: Install Ubuntu 20.04 LTS on Windows via WSL, Setup GitLab Runner on Windows WSL, How to install Windows Subsystem for Linux on Windows 11 via the Command line, and Microsoft Store, WSL: What is Windows Subsystem for Linux, Windows Subsystem for Linux: How to install WSL on Windows 10, and Windows Subsystem for Linux: How to install WSL on Windows Server via Server Manager and PowerShell.

Now, let’s address the installation process and any differences you may encounter when installing WSL on Windows Server compared to Windows 10 or Windows 11. Generally, the installation process remains quite similar across these platforms, but there is one crucial distinction when it comes to running WSL on Windows Server. Unfortunately, WSL 2 distributions are not available or supported on Windows Server 2019 but are supported on Windows Server 2022. However, this limitation doesn’t hinder the usage of WSL version 1 for all your distributions, so you can still enjoy the benefits of WSL on your server.

Install WSL on Windows Server 2022

Windows Server 2022 has made the installation process of WSL incredibly simple. With just a single command, you can install all the necessary components and get started with WSL. Here’s how:

Open an administrator PowerShell or Windows Command Prompt. Enter the following command:

   wsl --install

After executing the command, restart your machine to apply the changes.

running the command
Wsl –install command

Congratulations! You now have WSL installed on your Windows Server 2022.

By running the `wsl –install` command, you not only enable the required optional components but also download the latest Linux kernel, set WSL 2 as the default version, and install the Ubuntu Linux distribution by default.

How to Install Your Preferred Distribution on Linux on Windows Server 2022

If you prefer a different Linux distribution, you can install it by following the process below.

Open an administrator PowerShell or Windows Command Prompt. Enter the following command:

wsl -l -o

By running the command “wsl -l -o,” you can view the list of available Linux distributions and select the preferred one.

running the command
Command to view Linux distributions

Then, with administrative rights, execute the command shown below to initiate the installation:

wsl.exe --install -d <name-of-distribution>

After the installation completes, a reboot is required. Upon logging back in, the setup procedure will finalize the configuration by setting up the first Linux user and password.

Windows Linux integration
Command to install Linux distribution

Install WSL on Previous Versions of Windows Server

If you are using Windows Server 2019 (version 1709+) or an earlier version, you can still install WSL manually. Follow these steps:

Enable the Windows Subsystem for Linux (WSL) optional feature by opening PowerShell as an administrator and running the following command:

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

After executing the command, reboot your server to activate the changes.

Linux compatibility on Windows
Enable Windows Optional Feature

Download your preferred Linux distribution by visiting the official WSL documentation and following the instructions provided. Once you have downloaded the Linux distribution, navigate to the location of the downloaded file and open PowerShell in that directory.

Extract the contents of the distribution’s `.appx` package using the following PowerShell command:

Rename-Item .\Ubuntu.appx .\
Expand-Archive .\ .\Ubuntu

After extracting the contents, install the Linux distribution by running the following command in the same directory, replacing `app-name` with the name of the Linux distribution `.appx` file:

Add-AppxPackage .\app_name.appx
Install Linux distro on Windows Server
Install Linux distro on Windows Server

Note: If you encounter the error message “Installation failed with error 0x8007007e,” ensure that your system meets the minimum requirements for WSL and that you have enabled WSL and restarted your computer.

Add the path of your Linux distribution to the Windows environment PATH using the following PowerShell command, substituting `C:\Users\Administrator\Ubuntu` with the path of your Linux distribution:

$userenv = [System.Environment]::GetEnvironmentVariable("Path", "User")
[System.Environment]::SetEnvironmentVariable("PATH", $userenv + ";C:\Users\Administrator\Ubuntu", "User")

Congratulations! You can now launch your Linux distribution from any path by typing `<DistributionName>.exe`. For example, to launch Ubuntu, simply type `ubuntu.exe`.


By following this installation guide, you have successfully enabled the Windows Subsystem for Linux (WSL) on your Windows Server environment. Whether you’re using the latest Windows Server 2022 or an earlier version, WSL empowers you to leverage the strengths of both Windows and Linux ecosystems seamlessly. Explore the vast Linux software repository, utilize Linux command-line tools, and unlock a world of possibilities for your Windows Server. Get ready to take your server administration and development tasks to new heights with WSL!

Notify of

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x