DEV Community

Edson Canganjo
Edson Canganjo

Posted on • Edited on

WSL on Windows Server 2019

Did you try to install WSL2 on Windows Server 2019 through wsl --install?
Did you try to install Microsoft Store?

Unfortunately it doesn't work on Windows Server 2019.

But it has soluction.

The solution was based on the link below:

  1. Microsoft;

Just follow the steps:
Those steps below needs to be done other and Administrator

cd C:\Users\Administrator\
Enter fullscreen mode Exit fullscreen mode

Enable the Windows Subsystem for Linux

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
Enter fullscreen mode Exit fullscreen mode

Download a Linux distribution

Invoke-WebRequest -Uri https://aka.ms/wslubuntu2004 -OutFile Ubuntu.appx -UseBasicParsing
Enter fullscreen mode Exit fullscreen mode

Extract and install a Linux distribution

Rename-Item .\Ubuntu.appx .\Ubuntu.zip
Expand-Archive .\Ubuntu.zip .\Ubuntu
Enter fullscreen mode Exit fullscreen mode

Add your Linux distribution path to the Windows environment PATH

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

Start installation (change directory to directory where is ubuntu.exe)

ubuntu.exe
Enter fullscreen mode Exit fullscreen mode

If is it usefull, please leave your comment or suggestion.
If it doesn't work, let's try together

Top comments (3)

Collapse
 
acsr profile image
Armin Stross-Radschinski

You collected all the pitfalls and condensed it to the way I successfully used to get Ubuntu 20.04 LTS up and running under WSL in Windows Server 2019 Datacenter , but are you sure you ended up with WSL2? I got just WSL1.

If you cannot wsl --listyou are on WSL1.

I was on the official LTSC build Windows Server 2019 Datacenter build version "1809"

Check notes at serverfault.com/a/1052298: After 2020.1.31, there is no way to run WSL2 on Windows Server 2019 in Production except on Internal Preview versions after version 1709.

The only official MS info I found, was for Windows Server 2022:
WSL 2 distros are now supported on Windows Server
at devblogs.microsoft.com/commandline...

Collapse
 
edsoncanganjo profile image
Edson Canganjo

Yes! Indeed, it's about WSL1 and not WSL2 sorry for my mistake

Collapse
 
acsr profile image
Armin Stross-Radschinski

For the nail in the coffin read: github.com/MicrosoftDocs/WSL/issue...