How to Set Up WSL 2 in Windows 10
Getting started with the upgraded version of Windows Subsystem for Linux.
There are a lot of reasons why you might want to run Linux on Windows. Maybe you want the convenience and easy compatibility of Windows in your everyday life, but you also want to program in a Unix operating system environment. Maybe you just want to play around with Linux and see what it’s like.
Back in the day, you would have had to do all the setup for a virtual machine yourself. These days, though, we have Windows Subsystem for Linux, or WSL — Windows’ built-in ability to run Linux distributions.
And starting with Windows Feature Version 2004, there’s WSL 2. It’s better than the original WSL 1 in a whole bunch of ways that are beyond the scope of this blog post, but the main thing to know is that WSL 2 is faster and has more functionality. So that’s what we’ll be installing here.
Once you have WSL 2 up and running, it’s relatively simple to use, but actually getting to that point can be complicated. So here’s a basic guide for how to do it, including some common problems you might encounter and how to fix them.
1. Check which version of Windows you’re running.
Go to the start menu and type “about”. Click “About your PC” and check the number next to “Version” in the “Windows specifications” section. If the number is 2004, you’re good to go. If not, run Windows update to upgrade to the latest feature version of Windows.
Note: If you can’t update to Feature Version 2004, versions 1903 and 1909 are also OK, but you’ll at least need to install this update first.
2. Enable Windows Subsystem for Linux and Virtual Machine Platform.
Go back to the start menu and type “turn”. Click “Turn Windows features on or off” and scroll down to “Windows Subsystem for Linux”. Check the box. Do the same for the box next to “Virtual Machine Platform”.
Now restart your computer.
3. Make sure you’re on WSL 2.
Back to the start menu again. Type “powershell”, right click on Windows PowerShell, then click “Run as administrator” and click “Yes” when the prompt comes up.
In the PowerShell window, type “wsl -l -v”. If the result says you’re running version 2, you’re good to move on to the next step. If not, type “wsl --set-default-version 2”.
Note: If this leads to an error, go here to download the WSL 2 kernel. To avoid a very strange issue many users have encountered with this download, move it to another folder (any folder, just not Downloads), then run it.
4. Install Ubuntu (or whatever Linux distro you’d prefer).
Go to the Microsoft Store and download Ubuntu 20.04 LTS (or the previous version, Ubuntu 18.04 LTS, if you’d prefer that). You can use a distro other than Ubuntu if you’d like, but Ubuntu is usually recommended for beginner Linux users.