WSL 2 is Microsoft’s gift to Windows 10 developers that thrive well in the Linux development environment. If you’ve used and loved Windows Subsystem for Linux 1, you’ll appreciate the architectural and functional transformation its successor brings. And if you’ve decided to learn how to install Linux WSL 2, you’re probably as eager as many other developers around the world to explore its performance efficiencies, fast boot times, seamless Windows/Linux interactions, and other perks.
Another beautiful thing about WSL 2 is that it comes with a full Linux kernel. Plus, you don’t need to configure or manage any virtual machine to optimally leverage the platform. It uses an ultra-lightweight VM that runs behind the scenes, letting you focus on your core Linux development workflows.
If you’re ready to start exploring WSL 2 on Windows 10, here’s how to get the setup right:
Activate WSL on Windows 10
WSL is an optional feature in Windows, and it’s usually off by default. So, regardless of the WSL version you’re installing, you need to enable Windows Subsystem for Linux before proceeding.
Follow these steps to get started:
- Type “powershell” in the Windows search box and press enter
- Right click on Windows PowerShell in the search result and click on Run as administrator to launch the app
- Type this command: dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
There’s no need to restart your PC now since you’re setting it up for WSL 2 instead of WSL 1. But at least, at this stage, your computer is ready to install WSL 1 distros after reboot.
Follow These Steps to Install WSL 2 on Windows 10
Check Your PC System’s Specs
WSL 2 is built for superfast workflows, which is why it keeps getting a lot of love from Linux developers that still use Windows 10. But older versions of Windows (lower than build 18362) don’t support the underlying WSL 2 architecture, much less the VM experience.
Microsoft outlines prerequisites for installing WSL 2 as follows:
- You must be on a Windows 10 PC
- x64 PCs must be running on Windows 10 version 1903 or higher, and must have build 18362 or higher installed
- ARM64 PCs must have Windows 10 2004 or a later version installed, with build 19041 or a more recent version
You can still upgrade to Windows 10 version 2004 or even the October 2020 update if your current version is incompatible with WSL 2. Be sure to check out the Windows Update Assistant to get the latest WSL 2-compatible OS build.
Activate the WSL 2 VM
Just like WSL, the Virtual Machine Platform is off by default in Windows 10, so you need to turn it on before installing WSL 2. The game-changing virtualization technology is one of the reasons why WSL 2 performs much better than its predecessor.
To activate the lightweight utility VM that works so well on a real Linux kernel, follow these steps:
- Open the PowerShell app. Ensure to launch it as admin like you did the first time.
- Enter and run this command: dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
- Reboot your PC in preparation for a Linux kernel update
Download and Install the Latest WSL 2 Kernel Update
WSL2 runs a full Linux kernel with the help of one of the most advanced VM technologies. So, now you need to download and install the latest Linux kernel update. Here are the steps to follow:
- Get the latest Linux kernel update for your PC. You can download the package manually here if you’re using an x64 PC. ARM64 users can download the files here.
- Double click on the executable file to install the Linux kernel update on your Windows 10 PC. Approve all elevated permission requests to proceed with the installation.
Congratulations! You now have WSL 2 installed on your PC, and are ready to install your favorite Linux distros. But WSL 1, which is already installed on your machine, is the default platform for running the distros.
So before downloading any new Linux distros, you need to set WSL 2 as the default version on Windows 10.
How to Set WSL 2 as the Default Platform
These are the steps for setting WSL 2 as the default platform when adding new Linux distros:
- Launch PowerShell
- Run this command: wsl –set-default-version 2
Now you’re ready to add Linux distros to your new WSL2 setup.
Download and Install Linux Distributions
You probably have a favorite Linux distro in mind right now. Preferences depend on many factors, from your proficiency levels and operating environments to required hardware resources. Follow these steps to download and install your preferred WSL 2 Linux distro:
- Head on over to the Microsoft Store
- Select a solution from the distro list that includes Ubuntu, Kali Linux, Debian GNU/Linux, and more
- On the distro’s page, click Get to download and install it on your Windows 10 PC
Windows 10 takes one or two minutes to set up a new Linux distro for use. But once the distro integrates with the OS, it only takes a few seconds to launch.
If you’re a looking to leverage the rich Linux developer ecosystem and resources along with the excellent tools you have in Windows 10, WSL 2 never disappoints. Hopefully, you can now install and configure WSL 2 on your PC to start building robust software solutions.