Introducing the Windows Subsystem for Linux! + Learn How to Fix WSL Errors👨‍🔧

wsl on windows 10

0 Comment

8 mins Read

wsl on windows 10
Get your Forex VPS

Get your Forex VPS

Starting from $9.95/month.

Check it Out

Sometimes, Windows is not enough. Well, a lot of times, actually, especially if you’re a developer. But dual-booting your computer or turning to virtual machines can be both intimidating and a headache, not to mention hell on older systems. So, the next best thing? Not WSL, as you would think — I’ll reveal the next best thing at the end of this article, so make sure to read through if you want a better solution. The next-next-best thing? The Windows Subsystem for Linux. Whether you need WSL to get rid of the WSL error (“the windows subsystem for Linux optional component is not enabled”) or for some other reason, you need to enable it first.

What is WSL?

 

WSL is a hybrid, strangely half-functional way to use some Linux commands and applications inside Windows, using PowerShell. Naturally, the whole Windows vs Linux debate is not just solved by using WSL, but it is at least a temporary solution. It’s faster than a full-scale Virtual Machine (VM) and will produce less overhead. Still, neither does it guarantee functionality nor support all commands or applications. So, all in all, it’s a halfway measure that I can only recommend if you’re planning to do some cross-platform coding and compilation.

 

What is WSL2?

 

The new and improved Windows Subsystem for Linux, codenamed WSL2, is now installed by default when you go through the steps I’ve outlined here. WSL2 comes with major upgrades, including major support for Docker and Kubernetes containers and their deployment. Of course, it was high time for Microsoft to do something about making containers more accessible. Still, even WSL2 is far from perfect when it comes to containerization and code deployment. 

For now, let’s say you need to install WSL anyway; this is where this guide comes in. I’ve included all the necessary steps to enable WSL, even if you’re using an older Windows 10 Build. So, make sure to follow the instructions and read through for that much-more-awesome solution I promised. 

Also Read: How to Install Docker on VPS (Step by Step Guide)

Facing Down the Error: “the windows subsystem for Linux optional component is not enabled”

One of the main reasons users usually discover WSL and try to install it is running into a certain error message in Windows. Of course, there’s nothing new about seeing errors pop up in Windows, but this one is slightly more exotic than the others. The error message is usually something like “the windows subsystem for Linux optional component is not enabled.” 

The only way you can get rid of this error is by enabling the Windows Subsystem for Linux, and the instructions in this article help you do just that. So, let’s get started.

How to Enable Windows Subsystem for Linux?

To enhance your Windows with some Linux functionality, you need to enable the Windows Subsystem for Linux. You may also need to do it to get rid of the annoying “the windows subsystem for Linux optional component is not enabled” error) Despite the name sounding so technical, installing it is very simple. 

Basically, you have two ways of enabling WSL: the Control Panel and the PowerShell. Using the Control Panel is more straightforward and user-friendly. Still, sometimes it fails to do the job (for some unknown reason — cough cough Microsoft). Using PowerShell involves entering some commands into a command-line interface, which can be a bit intimidating to most casual users. But you will have all the commands you need right here, ready to be copied and pasted into PowerShell.

However, before going through with any of these methods, you need to know your Windows version and build. The Windows Subsystem for Linux is only available for Windows 10 version 2004 and later. Also, if your Windows 10 has a Build number before 16215, you will need to enable Developer Mode before you can start enabling WSL.

How to Find your Windows Version?

We have already dedicated another how-to article on finding the version of all types of operating systems, so I’ll keep this short and to the point. To find your Windows 10 version and Build number, follow these three simple steps:

Step1: Run the Application Launcher by pressing Windows Key + R

[Application Launcher]
[Application Launcher]
Step 2: Enter <winver> into the launch box
Enter “winver” into the launcher box
[Enter “winver” into the launcher box]
Step 3: Find your Windows version and Build number from the About Windows screen.
Finding the Windows version from the pop-up screen
[Finding the Windows version from the pop-up screen]

As you can see in the screenshot above, my Windows 10 meets both criteria (Version 2004, Build > 16215). If your Build number is less than 16215, you need to enable developer mode first.

 

How to Enable Developer Mode (for Windows 10 builds before 16215)

Developer Mode is a Windows feature that lets you install applications that aren’t Microsoft-approved or still in their beta stage. Enabling developer mode can also come in handy in other contexts, like when you’re trying to install some 3rd party application that’s not precisely Microsoft-approved. To enable Developer Mode, you have to follow these simple instructions:

Step 1: Open Settings

Step 2: Click on Updates and Security

Updates and Security panel in Settings
[Updates and Security panel in Settings]

Step 3: From the menu on the left, select For Developers

For Developers panel in Settings
[For Developers panel in Settings]

Step 4: Click on the On/Off toggle button to turn Developer Mode on.

Developer Mode enabled
[Developer Mode enabled]

Step 5: On the “Use developer features” dialog box, click on Yes

Confirm Developer Mode
[Confirm Developer Mode]
You are now in developer mode, meaning you will have permission to install non-standard software, including WSL, which was presented in Beta mode until Build 16215. With all the requirements now in place, it’s time to enable the Windows Subsystem for Linux.

How to Enable WSL via the Control Panel

Before running any Linux distros on Windows 10, you first need to enable the Windows Subsystem for Linux (WSL); you can follow these steps to do so:

Step 1: Open the Control Panel

Step 2: Click on Programs

[Windows 10 Control Panel Screen]
[Windows 10 Control Panel Screen]

Step 3: Click on Turn Windows Features on or off

Control Panel Windows Features
[Control Panel Windows Features]

Step 4: Find and select the Windows Subsystem for Linux box.

[List of Windows Features to turn on or off]
[List of Windows Features to turn on or off]

Step 5: Check the OK button 

 

Step 6: Wait for the Installation Wizard to finish configuring your Windows.

Windows Features installation wizard
[Windows Features installation wizard]

Step 7: Next, click on Restart now in the next screen

Restarting your Windows
[Restarting your Windows]

Once your Windows boots back up, WSL is enabled and ready for use. By default, the Windows Subsystem for Linux runs an Ubuntu terminal. If you need another distro, you can download it from the Microsoft Store and install it using these steps (or you can use the PowerShell method):

  1. Open Microsoft Store
  2. Search for Linux distros (Ubuntu, Debian, Kali Linux, etc.)
  3. Select the distros you want
  4. Click on the Get or Install button
  5. Click on the Launch button
  6. Create a username for your distros and press Enter
  7. Create a password for your distros and press Enter
  8. Repeat the password and press Enter to confirm

Now, your favorite distro will be up and running on WSL.

How to install WSL via PowerShell?

 

You can also use PowerShell to enable the Windows subsystem for Linux, especially if you enjoy using the command lines. 

To Install the WSL using PowerShell, follow these steps: 

  1. Open Start and search for PowerShell
  2. Right-click on the result and choose Run as administrator
  3. Type the following command to enable the Linux Subsystem and press Enter
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
  1. Open Start and Search for PowerShell
  2. Type Y and press Enter to confirm and restart your computer.

Your Windows 10 is now ready for you to download. To install the distros, follow these steps:

  1. Open Start and Search for PowerShell
  2. Right-click on the result and choose Run as administrator 
  3. Type in the following command and press Enter; this command will select and the download folder
cd c:\PATH\TO\DESTINATION-FOLDER

Note: write the path, as the download file path, for example, c:\data

  1. Type in the following command to download Ubuntu and press Enter
Invoke-WebRequest -Uri https://wsldownload.azureedge.net/Ubuntu_1604.2019.523.0_x64.appx -OutFile Ubuntu.appx -UseBasicParsing

Note: this command will download Ubuntu 16.04. To download the distros you want, simply type in the name and version you want.

  1. Type dir and press Enter to view the actual name of the installer
  2.  Type the following command and press Enter to install the distros. In the APP-NAME section, type in the distro’s name
Add-AppxPackage .\APP-NAME.appx
  1. Open Start
  2. Search for the distros and click the top result to launch the experience
  3. Create a username for your distros and press Enter
  4. Create a password for your distros and press Enter
  5. Repeat the password and press Enter to confirm

 

A Better Solution?

If you’re installing WSL not because you’re getting the error (“the windows subsystem for Linux optional component is not enabled”) but because you want to use Linux, then I think I can show you a better solution.

As I said at the beginning of this article, migrating from Windows to Linux is not exactly easy for most users. Saying goodbye to a familiar OS and entering the alien world of Linux is not an inviting prospect. So, most starting developers or web admins tend to either dual-boot their computer, which will put a lot of strain on your hardware and risk breaking everything, or use a VM. Virtual Machines have a very high overhead, however, and running two full operating systems at the same time (which is what running a VM does) will mean a considerable drop in performance for both. So, unless you have a super-expensive gaming rig at home, you need to find a better alternative.

That’s usually the part where users turn to the Windows Subsystem for Linux, which, as I explained, is like a halfway measure that lets you use only some of the commands and applications. Is it the best option if you don’t want to migrate, dual-boot, or use VMs? Not really.

Linux Hosting Simplified Linux Hosting Simplified

Want a better way to host your websites and web apps? Developing something new? Simply don’t like Windows? That’s why we have Linux VPS.

Get your Linux VPS

I recommend getting a Linux VPS plan and using it as a remote computer. Our Linux VPS offerings are distro-optimized hosting solutions featuring top-tier hardware, so you won’t have to worry about overhead at all. We also offer our VPS plans in more than 14 locations worldwide, so you’ll be able to set up a low-latency connection to your server wherever you are.

Alex is a senior content writer and strategist with an interest in all things tech. He has been working in content for some years, before which he was engaged in academic research on literature and philosophy. He loves writing, logic, and challenging himself.

Comments

Leave a Comment

Your email address will not be published. Required fields are marked *


Latest Posts