Setup a Linux Dev Environment on Windows 10
Also published at Dev.to.
Largely sourced from the official Microsoft docs.
Win 10 Build Requirement
You must be running Windows 10 build 1904 or higher (run ver
from cmd.exe to check).
A Fresh WSL Install
From PowerShell with Admin access (right click PowerShell or a PowerShell shortcut and Run as Administrator)
- Enable WSL, run:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
- Enable "Virtual Machine Platform", run:
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
- Download and install WSL 2 Linux kernel from Microsoft
- Restart Windows for good measure.
- Set default WSL to v2, run:
wsl --set-default-version 2
- Download your favorite Linux distro from the Microsoft Store (Yes, really. I searched for and installed "Ubuntu".)
- Launch and set up Linux by running
wsl
And you're off to the races! From here, I'm able to install Node.js, Typescript, Yarn, etc.
Upgrading from WSL 1
Instructions a work in progress...
- Update to WSL 2
- Set v2 as default WSL
- List existing distros
- Upgrade existing distro
- Remove unwanted ("Legacy") distro with --unregister