Please visit these pages for more details on how to install Windows Subsystem for Linux (Windows 10):
https://docs.microsoft.com/en-us/windows/wsl/install-win10
https://docs.microsoft.com/en-us/windows/wsl/user-support
https://docs.microsoft.com/en-us/windows/terminal/get-started
Windows Subsystem for Linux (WSL) 2 is a full Linux kernel built by Microsoft, allowing Linux containers to run natively without emulation.
Please make sure that your machine meet the requirements to run WSL 2 on Windows 10.
The following instructions were tested on Windows 10: They should work for x64 systems (version 1903 or higher), with OS Build 18362 or higher.
To check your system type, open Command Prompt or PowerShell and enter:
systeminfo | find "System Type".
To check your Windows version and build number, select
Windows logo key + R, type
winver, select OK.
-
Enable the Windows Subsystem for Linux.
Open PowerShell, as Administrator, and run the following:
-
Enable Virtual Machine feature.
Open PowerShell, as Administrator, and run the following:
-
Restart your machine to complete the WSL install and update to WSL 2.
-
Download the Linux kernel update package (WSL2 Linux kernel update package for x64 machines):
https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi
Double-click the package file to run the update package.
Important: you might get this error "Windows Subsystem is not enabled" when you run the update package.
One way to workaround that is to enable Windows Subsystem for Linux from the windows settings:
- On your windows machine, click Start, then click on the Settings icon.
- Click Apps
- Click "Programs and Features".
- Click "Turn Windows features.
- Find the "Windows Subsystem for Linux" check box.
If you already run the commands mention above, then this check box will be already checked.
In this case, uncheck the check box. Click OK. Restart your machine.
Once your machine restarted, go and check the "Windows Subsystem for Linux" check box. Click OK. Restart your machine.
- Try again to install the update package.
-
Set WSL 2 as your default.
Open PowerShell, as Administrator, and run the following:
-
Configure global options with .wslconfig
Please see this page for more details:
https://docs.microsoft.com/en-us/windows/wsl/wsl-config#configure-global-options-with-wslconfig
If you want to limit the memory and CPU that WSL 2 can use, then you need to configure the .wslconfig file.
The file should be placed into the root directory of your users folder: C:\Users\<yourUserName>\.wslconfig
Here's an example of some settings you can put in the .wslconfig file:
You might need to stop WSL 2 VM so the settings can be applied: wsl --shutdown
-
Install a Linux distribution (Ubuntu).
Open the Microsoft Store and search for Ubuntu.
Select "Ubuntu 20.04 LTS" App.
Click Get to install Ubuntu App.
Once the installation is completed you will be asked to create a user account and password for your new Linux distribution.
To set Ubuntu as your default WSL distro, run the following:
-
Install Windows Terminal.
Open the Microsoft Store and search for Terminal.
Select "Windows Terminal" App.
Click Get to install "Windows Terminal" App.