WSL2 now available on Windows Server 2022

Published May 31 2022 12:00 AM 8,963 Views
Microsoft

Hello folks!

 

If you’re one of those Devs/ITPros using the Windows Subsystem for Linux (WSL) you know how useful and powerful it can be.  We announced during Microsoft Build last week that WSL2 will be broadly available in June.  But I could not wait.  Here’s how I installed it.  It’s pretty simple.

 

Check it out!

 

PierreRoman_0-1653972076856.png

 

 

Pre-Requisites

 

First, Windows Subsystem for Linux requires Hyper-V and virtualization enabled on your computer.

 

Second, if you wait until June, you will get the update that is required for WSL2 to run properly on a Windows Server 2022, through the regular update process.  If you cannot wait you need to install the May 24, 2022—KB5014021 (OS Build 20348.740) Preview.  In the notes for the update, it does mention that you must install KB5005039, dated August 10, 2021, before installing the latest cumulative update (LCU).

 

In my case, my Windows Server 2022 box was already up-to-date so I was able to install the KB5014021 update by selecting it in the Optional quality update Section of the Windows Update section in Settings.

 

PierreRoman_1-1653972076883.png

 

Installing WSL2

 

The Windows Server Installation Guide as of the writing of this post has yet to be updated to show the procedure to install WSL2 on a Windows Server 2022.  However, the Install Linux on Windows with WSL documentation works beautifully as long as you’ve enabled the "Windows Subsystem for Linux" optional feature and rebooted first.

 

To do this we use the following command :

 

 

 

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

 

 

 

Now, to install the Windows Linux Subsystem, open PowerShell as Administrator and run this command:

 

 

 

wsl --install

 

 

 

Note: If you want to install additional distributions from inside a Linux/Bash command line (rather than from PowerShell or Command Prompt), you must use .exe in the command: wsl.exe --install -d <Distribution Name> or to list available distributions: wsl.exe -l -o

 

PierreRoman_2-1653972076891.png

 

And reboot your system.

 

After the reboot the installation will resume automatically.

 

PierreRoman_3-1653972076893.png

 

Set up your Linux user info

 

Once the Install is complete Ubuntu (the defaults distro, unless you specify one as mentioned in the Note above) will start and ask you to complete the setup by providing a username and a password for the account for your newly installed Linux distribution. See the Best practices for setting up a WSL development environment guide to learn more.

 

That’s it.  It’s ready for you and available in your start menu.

 

PierreRoman_4-1653972076902.png

 

Cheers!

 

Pierre

2 Comments
Co-Authors
Version history
Last update:
‎May 31 2022 12:00 AM
Updated by: