How to Install WSL 2 on Windows Server

A couple of months ago Microsoft announced the Windows Subsystem for Linux 2 (WSL 2), which is a successor of the Windows Subsystem for Linux shipped a couple of years ago. WSL 2 is currently available for Windows Insiders running Windows 10 Insider Preview Build 18917 or higher and with the Docker Tech Preview, you can now even run Docker Linux Container directly on WSL 2. With the latest Windows Server Insider Preview build 18945, you are also able to run WSL 2 on Windows Server. In this blog post, I am going to show you how you can install the Windows Subsystem for Linux 2 (WSL 2) on Windows Server. The Windows Subsystem for Linux was already available in earlier versions of Windows Server; however, WSL 2 brings a lot of new advantages.

The Windows Subsystem for Linux was in Windows 10 for a while now and allowed you to use different versions of Linux on your Windows 10 machine. With WSL 2, the architecture will change drastically and will bring increased file system performance and full system call compatibility. WSL 2 is now using virtualization technology (based on Hyper-V) and uses a lightweight utility VM on a real Linux kernel. You can find out more about WSL 2 in the release blog or on the Microsoft Docs Page for WSL 2.

Install Windows Subsystem for Linux 2 (WSL 2) on Windows Server

Here is how you can install WSL 2 on Windows Server.

Prerequisites:

Windows Server Insider Preview build 18945 or higher

A machine that supports Hyper-V Virtualization.

If you are installing your Windows Server in a virtual machine, make sure Nested Virtualization is enabled.

After you have installed a new Windows Server with the Windows Server Preview build, you will need to add the following features:

Microsoft-Windows-Subsystem-Linux

VirtualMachinePlatform

To enable these features, run the following command:

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

These commands will need a restart to complete.

Now you can install your Linux distribution which is available in WSL. You can also find the links to the Linux distro packages here: WSL distro packages. In my case, I am going to use Ubuntu 18.04, which is currently working with WSL 2.

Invoke - WebRequest - Uri https: // aka.ms / wsl - ubuntu - 1804 - OutFile ~ / Ubuntu1804.zip - UseBasicParsing md C:\Distros\Ubuntu1804 Expand - Archive ~ / Ubuntu1804.zip C:\Distros\Ubuntu1804

Before you start and configure your WSL distro, I recommend that you set the WSL default version to 2. This will make the setup of your distro much faster.

wsl -- set - default - version 2

Now you can start ubuntu.exe to run WSL.

C:\Distros\Ubuntu1804\ubuntu1804.exe

I hope this gives you a step-by-step guide on how you can install WSL 2 on Windows Server. Remember this is currently in preview, and not for production use. If you want to install the Windows Subsystem for Linux on Windows Server 2019, check out this blog post: Install Windows Subsystem for Linux on Windows Server.