Windows Subsystem for Linux (WSL) is a feature of Windows 10 and 11 machines that allows for simultaneous running of both Windows and Linux at the same time. This works by adding a hypervisor layer between Windows and your machine that Linux then connects to. This minHour will show you how to install WSL on your machine.
Enabling WSL from Windows Features
Open the Windows Features dialog.
To do so, search for “Turn Windows features on or off” from the taskbar then select it.
Find “Windows Subsystem for Linux” from the features list.
Make sure that box is checked.
Click OK.
This will apply the feature changes to your machine.
Restart your machine when prompted.
To enable the new hypervisor, your computer will need to be restarted. Windows also has to change a few settings to make WSL work on your machine.
Update WSL.
Before use, you should update WSL to the latest version. To do so, run wsl –update in an elevated PowerShell or Command Prompt window.
- To start an elevated terminal, search for “Command Prompt” or “PowerShell” or “Windows Terminal”, click “Run as administrator”, and accept the elevation prompt. Windows Terminal will display a security shield after elevation is successful.
Shut down WSL.
Before the updated WSL can run, you have to terminate the process. This can be done with the command wsl –shutdown. Once WSL is shut down, you can start your Linux distribution and get all the latest features.
Install a Linux distribution.
You can install the default (Ubuntu) quickly by running the command wsl –install. To install a different Linux distribution, run the command wsl –install .
- You can also visit the Microsoft Store to select a distribution of your pick.
Create an account on that distro.
The account will be only for that one particular distro. If you install a different distro, it will require its own credentials. Type a username and set a password when prompted. After, you are all set to use that particular distribution.
Enabling WSL from the Terminal
Open a PowerShell window.
This icon has a white arrow on a blue background.
Attempt to install a Linux distribution.
You can install the default (Ubuntu) quickly by running the command wsl –install. To install a different Linux distribution, run the command wsl –install .
- You can also visit the Microsoft Store to select a distribution of your pick.
Restart your machine when prompted.
To enable the new hypervisor, your computer will need to be restarted. Windows also has to change a few settings to make WSL work on your machine.
Update WSL.
Before use, you should update WSL to the latest version. To do so, run wsl –update in an elevated PowerShell or Command Prompt window.
- To start an elevated terminal, search for “Command Prompt” or “PowerShell” or “Windows Terminal”, click “Run as administrator”, and accept the elevation prompt. Windows Terminal will display a security shield after elevation is successful.
Shut down WSL.
Before the updated WSL can run, you need to terminate the process. This can be done with the command wsl –shutdown. Once WSL is shut down, you can start your Linux distribution and get all the latest features.
Launch your Linux distribution.
To do so, type the command wsl without any parameters. You can also search for your Linux distribution from the search box by typing in the name of the distribution you installed and clicking it.
Create an account on that distro.
The account will be only for that one particular distro. If you install a different distro, it will require its own credentials. Type a username and set a password when prompted. After, you are all set to use that particular distribution.
Verifying the Install Worked
Open WSL.
To do so, run the command wsl, either from the run box or from a terminal window.
Install x11-tools.
To do so, first run the command sudo apt-get update to update the local package data, then run the command sudo apt-get install x11-tools to install.
Open Xcalc.
Xcalc is a basic calculator app that you can use to see if your WSL installation is working. To run it, type xcalc into the WSL bash window. This will open the calculator.
- GUI apps only work on WSL2 with WSLg.
Try dragging the calculator around and resizing it.
You can also try inputting in a calculation, like 1 + 2. If you can do this, then it means that your WSL machine is working.
Install some other packages.
You can install most apps and packages by running the command sudo apt-get install . Some common packages that are installed include gedit, nautilus, and firefox. Other packages include those used for development like Python or Apache Server.