WSL 2 == Microsoft's love for Linux
Development on Linux
I switched to Linux last year and shifted my development completely to the Linux ecosystem. Tried out arch, Manjaro, Pop OS!, Ubuntu, MX Linux. Development is really productive with a Linux environment.
Gaming on Windows
A few months back I upgraded my potato to a gaming laptop which of course came with Windows pre-installed, I also started gaming. I ended up doing dual boot to run Ubuntu as my daily driver for development, but this eventually meant a redundant set of tools on Windows as well.
Windows π Linux
Windows released the Windows Subsystem for Linux 2 in May 2019. WSL 1 was a compatibility layer for running Linux binary executables on Windows. WSL2 built on top is built on the core technology of Hyper-V to provide better support and improved performance running a Linux kernel.
Why WSL 2 instead of native Windows
Most production environments run on Linux and with WSL 2 environment the tooling available on development become the same as in production. Also WSL 2 is super easy to set up and get started with.
Set up WSL 2 on Windows
Open an elevated Powershell (Run as administrator) from the start menu and use the following commands to get WSL 2 up and running.
(Note that: WSL 2 is only available in Windows 10, Version 1903, Build 18362 or higher)
Step 1 - Enable the Windows Subsystem for Linux
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
Step 2 - Enable the Virtual Machine feature
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
You need to restart your PC after this step.
Step 3 - Download & install the Linux kernel update package
https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi
Step 4 - As a final step set WSL 2 as your default version
wsl --set-default-version 2
Now you can install your favourite Linux distro from the Microsoft Store. After the installation completes you'll need to restart and complete the setup of your Distro.
Enter the username and password for root user and you are good to go.
Set your default Linux distro for WSL 2.
wsl --set-version <distribution name> <versionNumber>
πππThat's it you have successfully set up WSL 2 and can now begin your journey to become a 10x Developer.
Feel free to reach out to me on Twitter @cryptus_neoxys and connect with me on LinkedIn.
Refs & Resources
If you loved the article and would like to support me, you can buy me a coffee.