Yesterday I made a post talking about Windows Subsystem for Linux 2.0 and the improvements over 1.0.
This post will go over how to install Windows Subsystem for Linux 2.0 if you don't have it installed already and how to upgrade if you have WSL 1.0 already installed.
You first need to make sure you have Windows 10 build version 2004 or greater. You can check your build by going to system.
If you do not already have 2004 and you do not see any updates under Windows Update, you can force the install by using Microsoft Windows Update Assistance. The upgrade will take around an hour.
In the start menu launch the program and features settings by typing in features
You want to select both Windows Subsystem for Linux & Virtual Machine Platform
Once these finish installing, you will be asked to reboot.
Seeing as Microsoft now uses a real Linux kernel with WSL 2.0, you need to install the kernel update patch.
Microsoft is using a real Linux kernel and no longer running a translation layer for system calls.
If you already have Linux installed for WSL 1.0, you can update it to 2.0 so it can take advantage of all the new features using the commands:
wsl -l -v
This will list out all your Linux installs.
You can then update them by name.
wsl --set-version Ubuntu 2
I recommend setting the default version to 2.0 for future installs.
wsl --set-default-version 2
Depending on how much you have used your Linux distribution, the conversion to 2.0 can take a little time.
If this is a new install of WSL, you can download your choice of Linux from the Microsoft Store.
Do a search for Linux in the Microsoft Store and this should bring up most of the options available.
I recommend Ubuntu 20.04 but you can choose any of the other options.
Once installed, it will prompt you to create a user.
I also recommend installing Windows Terminal. It is a beta product from Microsoft that allows you to easily launch Powershell, CMD, and Bash from the same terminal.
It also allows you to quickly start your Linux distribution, I typically will just use my SSH client but Linux is not started when Windows is started. So you need to initially start it and optionally SSH.
At this point, you are all set and can start using & developing Linux native applications within Windows.
WSL 2.0 is not a virtual machine (even though it does use a tiny virtual machine to bootstrap it). WSL is a full-blown Linux distribution running native Linux applications.
The performance of WSL 2.0 is amazing compared to WSL 1.0, in most cases, it is near-native speed now.
My next post will cover a cool feature that allows you to use WSL 2.0 to develop on Windows much easier than you thought possible.
Securely chat with me on Keybase