Linux Windows Compatibility

How to Enable WSL Optional Component for Linux

WSL is a Windows-based developer’s tool that lets you run GNU/Linux environments. Windows users can now avail the functionality of several command-line tools. However, before the availability of WSL, virtual machines were the only option to use Linux on Windows. During the configuration of WSL to use a Linux distro on Windows, the user may encounter the enabling error of WSL. To solve this, we have prepared this guide that addresses the following concerns:

  • Enabling the WSL on Windows
  • Verifying that WSL is configured/enabled correctly

Method 1 : How to enable WSL on Windows using GUI

The following steps must be carried out to enable the WSL in the Windows operating system.

Step 1: As the WSL is used mostly by developers who work on open-source projects. Therefore, firstly, you have to enable developer’s mode in Windows. Open Settings by searching it from the search icon on the taskbar:

Open “Updates and Security“:

Scroll down the left pane and click on “For Developers“. Turn on the toggle button of “Developer Mode” and a prompt will appear to confirm the enabling of “Developer Mode”.

Step 2: After enabling the developer mode, press “Windows Key + R” to open the run box and execute the optionalfeatures.exe:

Scroll down and switch ON the feature named “Windows Subsystem for Linux”:

Note: The optionalfeatures.exe service is available by default on your windows system that shows several optional services.

Method 2: How to enable the WSL on Windows using PowerShell

PowerShell is an open-source and widely used command-line tool that automates several tasks. In order to enable WSL in Windows, one can also use PowerShell by using the following command.

> Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

How to get Ubuntu on Windows using WSL

Once the “Windows Subsystem for Linux” feature is enabled successfully, one can install several Linux-based distros from the Microsoft store. Here, we will guide you to install Ubuntu using the Microsoft Store:

Open the Microsoft Store by searching it in the Windows search bar. Once the store is opened, search for Ubuntu 20.04(as the latest LTS is 20.04) and navigate to the Ubuntu 20.04 LTS:

To proceed further, click on the Install button:

The downloading will be started:

Once the downloading is finished, you will observe the Open button. Click on it to get yourself to Ubuntu’s terminal:

After opening the Ubuntu terminal, a few installation steps will start (automatically):

After installation, the terminal asks you to enter the UNIX username and set a password:

After successful installation, you can also verify the installation by using the following WSL command in PowerShell. The output displays the current state of Ubuntu and in our case, it is running:

> wsl -l -v

Yeah, here you go with Ubuntu 20.04 LTS. Let’s show you our experience as we have executed a few Ubuntu commands on the terminal:

Conclusion

Microsoft has evolved its operating system by keeping an eye on the modern day’s requirements. The WSL feature of Windows allows you to access various Linux distros from Windows. In this post, we have provided possible ways to enable the feature named Windows Subsystem for Linux(WSL). This guide contains two methods to enable the WSL feature: The first method refers to the graphical support for enabling whereas the second method can be practiced to enable WSL using PowerShell. For further verification, we have shown the installation of Ubuntu 20.04 LTS from the Microsoft Store.

About the author

Adnan Shabbir

Page was generated in 0.058143138885498