Adventures in Windows Subsystem Linux 2

I bought a new laptop, and rather than install Git for Windows, I wanted to install Git.  For reals.

To do this, you need to join the Windows Illuminati and enable the Fast Ring to get a version that includes WSL2.  This requires a couple or three reboots.

Trackpad snippet circles are the worst.

Open up Powershell as administrator and execute the following commands, the first two of which require a reboot:

Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform

And enable the WSL2 as a feature in Windows:

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

Then, set WSL2 to be the default architecture (instead of WSL1):

wsl --set-default-version 2

Download Ubuntu 18.04 LTS for Windows (saying this requires certain mental effort even to parse).  Launch It.  This registers it with WSL, among other things.

After installing, run the following command to make sure it runs in the proper context, even if the default were to change:

wsl --set-version Ubuntu-18.04 2

From now on, you should be able to go to a Command Prompt and type bash ...and suddenly you are in bash and logged in as the Ubuntu user you gave during the install.

As for me, I'm just getting started playing with this deep integration, but I'm seriously looking forward to using git and ssh as fully functioning Linux commands, instead of the wonderful but non-portable Putty variants.  Enjoy!

Updated (Day 1)

What I will say is that much like Las Vegas, commands that are inside WSL2, stay in WSL2.  I was disappointed that there seems to be a clear separation between Windows execution context and Linux execution context.  Proof is that you can drop to a cmd window and do this:

C:\Users\Jason Hughes>ssh -V
OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5

C:\Users\Jason Hughes>bash -c "ssh -V"
OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n  7 Dec 2017

This is not going to solve all my problems, sadly.  I really wanted to get git and ssh running inside WSL2 and call them directly from other programs that are made for Windows.  Not.  Gonna.  Happen.

Even so, I fully plan on running all manner of sweet Docker images inside the WSL2 context and talk to it with Docker Desktop (on the Windows side), so there's still plenty of benefit, just not the one I was hoping for.