How to Install and Use the Windows Subsystem for Linux

How to Install and Use the Windows Subsystem for Linux

Understanding How to Install and Use the Windows Subsystem for Linux - A Comprehensive Guide

In the modern computing epoch, there has been a seismic shift in how operating systems function and interact. A great illustration of this is Microsoft's Windows Subsystem for Linux (WSL). This development has perpetuated the cross-platform capabilities, allowing developers to run a GNU/Linux environment directly on Windows, without the overhead of a traditional virtual machine or dual boot setup. This guide shines a light on the process of installing and using WSL.


What is the Windows Subsystem for Linux (WSL)?

The WSL is a compatibility layer for running Linux binary executables natively on Windows 10 and Windows Server 2019. Surprisingly, WSL does not use a virtual machine, but it provides a compatibility layer for Linux binaries. This innovation enables you to utilize a wide range of Linux distributions inside Windows.


Installing the Windows Subsystem for Linux

Installing the WSL on your Windows OS is no big feat. Below is a step-by-step guide on how to do so:


Step 1: Enabling the WSL

Open the PowerShell as Administrator and run the following command: dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart


Step 2: Enabling 'Virtual Machine Platform'

Additionally, the 'Virtual Machine Platform' has to be enabled for acquiring the latest WSL 2 features. Execute the following command in the same PowerShell: dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart


Step 3: Installing a Distribution

Choosing a Linux distribution is a very personal decision. Get the distribution of your choice from Microsoft Store, such as Ubuntu, OpenSUSE, or Debian. Once chosen, click ‘Get’ for downloading and installing the respective distribution.


Using Your Installed Linux Distribution

Once the installation of your Linux distribution is complete, launch it. A console window will pop up, asking for a new username and password, which will be used for the sudo command later. Now, you have set up a Linux username - you can use Linux commands, install more software with the apt command, or access your local file system with the Linux /mnt/ directory.


Setting WSL Version

Microsoft offers two versions of the WSL, namingly WSL 1 and WSL 2. Depending on your preference and the degree of stability and performance you need, switching between the versions is effortless and requires just one command.


Conclusion

WSL grants the convenience to run Windows and Linux simultaneously. Its installation is a breeze and its benefits are abundant, especially for developers who can now effectively use scripts and commands from a Linux terminal in a Windows environment. The world of WSL thus signifies the growing symbiosis between different OS systems.