Windows 10 has encroached on Linux with the WSL – Windows Subsystem for Linux (Windows subsystem for Linux). With the introduction of WSL2, an updated version of WSL, users can now use the Linux kernel to execute Linux tasks from Windows. With the introduction of the latest version of Windows 20H1, WSL2 is set to go live. So, in this article, I will guide you to install Windws Subsystem for Linux on Windows 10.
First of all, if you want to learn about Windows Subsystem for Linux on Windows 10, the following article will introduce you to what WSL and WSL2 are? Let’s get the basics before continuing.
WSL2 or Window Subsystem for Linux 2 provides the user with a Linux console environment under Windows 10. So you should be able to run Linux binaries from Windows 10 without using a virtual machine. Furthermore, WSL can be used for services and tools in the Linux kernel. on the command-line interface. But the most important is still the bash shell.
In this tutorial, I will show you how to install Windows Subsystem for Linux in 2 ways.
- Using a graphical interface (GUI)
- Use PowerShell and Command line in Windows 10
In addition, I will show you how to install different Linux distros from MIcrosoft Store. But, if you want to install those distros then you must first install WSL.
Install Windows Subsystem for Linux using a graphical interface
Request:
- Stable internet connection.
- Windows 10 Aniniversary 1607 version for WSL.
- Windows 10 version insider 18917 for WSL2.
- Supports Hyper-V.
Installing WSL using the Settings software and Control Panel is the way of choice, as it is very easy to use. Here are the steps to install WSL in Windows 10:
- Press Windows + R and type Control.
- Continue to click on Programs.
- Under Programs and Features. Click Turn Windows Features on or off.
Alternatively, you can also open the Settings app on Windows 10 and then go to Apps > Programs and Features > Turn Windows features on or off.
- Now, the Windows Features window appears. Here, you can enable and disable Windows features using checkboxs.
- In the list of checkboxs, scroll down and find the Windows Subsystem for Linux option.
- Tick on that checkboxs.
- Click OK to install WSL on Windows 10.
- Finally, click Restart Now.
Install Windows Subsystem for Linux using Windows 10 Powershell
If you have ever used Linux, then it is no stranger to using commands anymore. For these people, typing commands will be much more fun than using the GUI (it’s a pleasure to use commands, guys).
Other than installing WSL2 using GUI, we can also use Powershell to enable WSL in Windows 10. To install WSL using Powershell, follow these steps:
- Click Start menu and type Powershell.
- Right click on the first result and choose run the application as an administrator.
- You type the following command and Enter:
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
- After running the command, PowerShell will ask you to restart your computer to apply the changes.
- So, you press “Y” to complete and confirm reboot.
After restarting, your Windows 10 should have Windows Subsystem installed.
Install Linux Distros on Windows 10
After installing Windows Subsystem for Linux, we can proceed to install Linux distros in the Microsoft Store.
- Click Start and then select Microsoft Store.
- Search the distro you like best to install on Windows 10.
- If you want to see all the Linux distros on the Microsoft Store, you can search for the Linux keyword and press Enter.
- Finally, click Install or Get.
Once installed, the distro will be located in the Start Menu. When you run the distro for the first time, a short setup process will take place. Basically, it will ask for the username and password you want to set for Linux.
WSL2 setting: Change from WSL to WSL2
After you have successfully installed the Linux distro with WSL, you must change from WSL to WSL2. Until the changes are successful, the distro will run in the WSL environment.
- Open PowerShell as administrator.
- Check if Linux is installed with the command:
wsl -l
- Next, you run the command:
wsl --set-version <distro> 2
Replace “<distro>” with the name of the Linux distro you installed - You can use the command below to set WSL2 as the default architecture for all Linux distros.
wsl --set-default-version 2
Uninstall Linux distros on Windows 10
You can uninstall Linux distros in the following ways:
- Open the Settings app.
- Select Apps, then click Apps & Features.
- Select the distro and click Uninstall.
And thus the Linux distro has been completely removed from your computer.
Uninstall or disable Windows Subsystem for Linux
Uninstalling or disabling WSL on Windows 10 is also very simple. To uninstall WSL on Windows 10, follow the steps below.
- Open the Settings software.
- Select Apps Settings.
- Go to Apps > Programs and Features > Turn Windows Features on of off.
- Scroll down to the Windows Subsystem for Linux option.
- Uncheck that item.
- Click OK and reboot.
Uninstall or disable WSL on Windows 10 using PowerShell
- Open PowerShell with admin rights and enter the following command:
Disable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux - Press Y to restart the machine.
You have successfully disabled Windows Subsystem for Linux on your device.