Install WSL and Ubuntu on windows server 2019
Enable the Windows Subsystem for Linux (WSL)
from powershell run as admin
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
This can be done from some menu as well. Just google it.
Now can run the wsl command
Download a Linux distribution
See the Downloading distributions section of the manual installation page for instructions and links to download your preferred Linux distribution.
https://learn.microsoft.com/en-us/windows/wsl/install-manual#downloading-distributions
Or
use powershell to do the download.
Switch to the folder for keeping the download file and run:
Invoke-WebRequest -Uri https://aka.ms/wslubuntu2004 -OutFile Ubuntu.appx -UseBasicParsing
This downloads the ubuntu 20.04 distribution as Ubuntu.appx file
The ubuntu2004 is a appx file, but the ubuntu2204 is a appxbundle file. The bundle seems not working,
It seems the ubuntu distribution has been wrapped as an app in windows.
Once download is done. Go to the folder.
Install the distribution's appx file
Add-AppxPackage .\Ubuntu.appx
After added, the Ubuntu will be avaiable in the windows menu as an APP
Simply click to run the app
It will start installing, and ask for username and password to be setup
"
Installing, this may take a few minutes...
Please create a default UNIX user account. The username does not need to match your Windows username.
For more information visit: https://aka.ms/wslusers
Enter new UNIX username: your user name
New password:
Retype new password:
passwd: password updated successfully
Installation successful!
"
all done. next time just run the app.