Install a Ubuntu 20.04 on Windows Servers using WSL

I love the speed and fast response of the file-system using wsl / Ubuntu as a terminal from my Windows 11 PC as a gateway to ssh and all things cloud terminal.

I really wanted to bring this flexibility to the main Windows Server I use.

Yesterday, I spent a few hour pulling my hair out. It should have been easier. IMHO with the Windows Server version of Windows 11 is out, I think this is going to be an epic leap forward for developers and DevOp admins, but for now. here is what I learned:

  1. Windows Server 2019 Standard does not have the Windows Store installed by default (nor should you want it)
  2. WSL/Ubuntu is normally installed via the Windows Store – just pick your installation and click Install (once you have turned on WSL in Features)
  3. To install WSL/Ubuntu from GitHub you download the appx package and try to use a Powershell command Add-AppxPackage Ubuntu_2004.2020.424.0_x64.appx which was new to me as I have avoided Powershell as much as possible. anyway, that didn’t work either.
  4. I tried renaming the appx package to a zip file then unzipping it, but it sets the permission wrongs and I wasn’t able to run ubuntu as a non admin, so I ras as admin but eventually ended up nuking the distribution and starting again.
  5. To nuke a distribution, a quick search sent me down the wrong path because my version of Windows Server 2019 10.0.17763 Build 17763 uses WSL version 1 and not WSL version 2 as most documentation references. To nuke a WSL version 1 distribution you need to use WSLConfig , see this post.
  6. I had permission problem running Ubuntu2004.exe as a non admin user, turns out that you also need powershell to extract the files from the appx bundle like this: Rename-Item .\Ubuntu.appx .\ then do Expand-Archive .\ .\Ubuntu (A microsoft doc helped here)
  7. Tried to install windows terminal with Add-AppxPackage but that had external dependencies any very quickly I ran out of patience and gave up on Windows Terminal. Again, Windows Server 2019 Builde 17764 just isn’t ready for the big league. Roll on the Windows 11 version of Windows Server what ever that version is, because again I’m totally confused by the nameing at the moment. Windows Server 2022 or Window Server dot or something else?
  8. Running Htop gave a blank screen, but managed to find a fix using export TERM=xterm-color