Install Windows Subsystem for Linux
Windows Subsystem for Linux (WSL) lets you run your Linux distributions on Windows. The following is a quick guide to get up and running with WSL and upgrade to WLS2. Also, some issues you may run into when installing it yourself.
NOTE: You must be on windows version 1904 or greater (you can click the windows icon and type winver
to check)
Enabling Windows Features via PowerShell
To check if your running Windows version 1904 or greater, press the windows + R
keys on your keyboard and type winver
If your version of Windows is less than 19.04, consider signing up for the Windows Insider Program
In order to run WSL, you must install the windows feature. Open up PowerShell (as administrator) and run the following command: dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
In order to run a Linux virtual machine on your PC, you must install Hyper-V. This is also enabled via PowerShell with the following command: dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
IMPORTANT: You must reboot your PC after enabling Hyper-V
Download and Install the Linux Kernel
Type the following into your web browser, which will download an msi installer: https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi
Run the msi installer (double-click the file you just downloaded). A wizard will pop-up on your screen. Click on Next, followed by Finish (That's it!).
You can verify that WSL is now installed by running the following command in PowerShell: wsl
Set the Default Version of WSL to 2
Set the default version of WSL to version 2. Version 2 is far superior to version 1, with benefits like increase file system performance and a full linux kernel. check out the full list of differences here.
Use this command in PowerShell: wsl --set-default-version 2
Run Ubuntu 20.04 on WSL2
Click on this link to download, install, and launch Ubuntu 20.04 from the Microsoft Store
When you click on the Launch button, this will open a terminal to your new Linux VM. In the terminal, you'll be prompted to enter a new password.
🎉 Congratulations!! 🎉
You've successfully installed and set up Ubuntu completely integrated within Windows 10!
Common Issues
Enabling Hardware Virtualization
In order to run Hyper-V on Windows 10, you must enable Hardware Virtualization. This allows you to run a hypervisor on your machine and share resources like CPU and RAM. On most machines, you must enable this in the BIOS.
Running Docker Desktop for Windows
When you enable the Windows Feature for WSL (the very first command we ran in this article), you'll get this popup from Docker Desktop.
The powershell script recommended in this message is the same as the first command we ran in this article.
Good News! If you're running Docker Desktop, You can now run containers on WSL! See how to use WSL (instead of Hyper-V) in Docker Desktop here.