Windows Subsystem For Linux (WSL): Is It Worth Trying? | One PC Panda

The Windows Subsystem for Linux (WSL) is a simple Windows executable that you can install via the Windows store. It is a feature of the Windows operating system that lets you run Linux files, command-line tools, and UI applications directly on Windows. 


It’s a tool that makes it convenient for Linux users to access and run their applications natively on Windows and without the need for dual booting, a second computer, or constantly run a virtual machine. With WSL, you don't need to maintain separate Linux and Windows build scripts.


WSL was made available to most Windows 10 and Windows 11 through the Windows Insider program or manual installation. 


How does the WSL work?


Windows Subsystem for Linux (WSL) was developed and intended to provide developers and sysadmins with Linux interoperability in Windows. It does more than just run your favorite Linux apps, but also runs Linux binaries unmodified. For instance, WSL allows you to download, install and run Ubuntu alongside your Powershell terminal, or use bash commands such as git and ssh. 


What you need to understand about WSL: 


It is not a virtual machine or container. WSL is essentially a device-driver that can intercept and translate Windows kernel system calls to Linux kernel system calls and vice versa. 


It is not a full Linux desktop. WSL lets you run Linux natively on Windows. Although it runs most applications and is better than running a virtual machine, it is however not a full Linux desktop. It is a simple shell and environment where you can run your commands, tools, and applications. At the moment, it does not support Linux graphical user interface (GUI) environments such as Gnome or K Desktop Environment


Linux and Windows share resources via WSL. Because it is not virtualized, Windows can run most Linux applications and share the same network interface. This means Linux can also access Windows services, share filesystem, environment variables, and network resources. 



Why use Windows Subsystem for Linux instead of running Linux in a VM?


WSL offers 2 great advantages over running Linux in a VM. First, is having better computing resources. Because WSL allows Linux access to shared resources, you have a better processor, memory, and storage as compared to a limited VM. 



Should I use WSL?


Since its release, WSL has been stable and is highly recommended by developers rather than using a virtual machine (VM). WSL provides better compatibility in running Linux command-line tools, utilities, and applications. It is intended as a tool for web developers with open source projects that runs Linux server environment but with limited access to full Linux systems. WSL allows developers to run common Linux tools unmodified while still being able to access Windows tools. 


With your choice of distribution, you can install and launch Ubuntu, Debian, OpenSUSE, Kali, Alpine, and more in a Bash shell and run command-line Linux applications and tools.


Not every Windows can run WSL. There is a prerequisite for you to set up and enable WSL. Your computer should be running:


  • Windows 10 64-bit computer Build 18917 or later.

  • Windowsx64 systems 1903 with Build 18362 or later. 

  • Windows ARM64 systems Version 2004 or higher with Build 19041 or later.


Windows versions with builds lower than 18362 will not be able to support WSL 2.


Update your Windows version by using Windows Update Assistant. To know your Windows 10 build, run the winver utility.


  1. Click on Windows type in the search box.

  2. Type in winver and press enter. 

  3. A window with your Windows version will pop up. 



WSL 1 vs WSL 2


There are 2 versions of Windows Subsystem For Linux: WSL 1 and its newer version the WSL 2. These versions are both offer Linux and Windows integration. The difference between WSL 1 and WSL 2 is that WSL 2 runs inside a managed VM and runs in a full Linux Kernel. The newer version WSL 2 is kept up to date and has 100% system call compatibility as compared to WSL 1.  


WSL 2 runs a special Linux Kernel which you can install and run on a lightweight VM platform. Since it has better system call compatibility, it runs kernel modules and drivers that are not available with WSL 1.  For instance, you can run Docker on your WSL 2 which is not available in WSL 1. It also starts quickly and runs faster as compared to using heavyweight VMs such as Hyper-V or Virtual Box.


How to enable Windows Subsystem For Linux


WSL is available in most Windows 10 and Windows 11. However, it is still an optional feature that requires you to enable to turn it on.  Here are the steps to enable WSL on your Windows. 


Simplified WSL Installation on Windows 11:


  1.  Open Powershell as administrator at the start menu and run the following:


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


  1. Restart our machine to apply the changes. After that, open Windows Store and search for “WSL”. Choose your distribution to install.  

  2. A window will prompt you to set up your username and password. This is only for your Linux system and does not necessarily have to match with your Windows password and username. 

  3. The first app you install will be automatically set as default. However, if you install multiple Linux distributions, you can manually select the default. 

  4. Manage WSL via wsl command in Powershell. 



Enable WSL 2: 


  1.  Open Powershell as administrator at the start menu and run the following:


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


  1. You must first enable the Virtual Machine Platform before installing WSL 2. To enable the VM Platform, open PowerShell as administrator and run:

dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart


  1. You will have to restart your machine to complete the WSL installation and update to WSL version 2.

  2. Download the latest Linux Kernel package. 

  3. Double click to run the Kernel package.

  4. Select “yes” once a window pop up asking for elevated permission to complete installation. 



Setting your WSL Version


You can set your default WSL distribution using the following command, which you also used to enable WSL 2. 


In your PoweShell console run the following:


  1.  List the versions of Linux distributions you have installed by running wsl --list

  2. Once you have the list, copy the name of the distribution you want to run with your WSL 2 and run wsl --set-version <distribution>


example:  wsl --set-version Ubuntu-20.04 2

  1. Set your default WSL version for your future installs. 

wsl --set-default-version 2

Creating Profiles of Windows Subsystem for Linux to the Windows Terminal

Adding WSL console to the Windows Terminal allows you to add and access each of your WSL distributions in its own tab. You can also customize the look of your profile for easy identification. 

Starting up WSL

There are several ways to open WSL. The most common is by simply opening it on Windows and type in “wsl” which will automatically run wsl.exe and open your default distribution. 

If you are using Microsoft’s new Terminal App, your WSL versions can be accessible via dropdown menu. It also opens the SSH profiles you have set up. 

Currently, WSL is now a downloadable app from the Windows Store, making it easier for Windows 11 users to simplify the installation process. If there is a need to run both Linux and Windows simultaneously with better computing resources and much faster to launch, WSL is a great alternative to virtual machines. No need to install multiple operating systems on a single computer and keep switching. WSL has made it convenient for developers and provides full Linux Shell experience despite running Windows as the primary operating system.


Comments