Windows Subsystem for Linux
The Windows Subsystem for Linux lets developers run a GNU/Linux environment – including most command-line tools, utilities, and applications – directly on Windows, unmodified, without the overhead of a traditional virtual machine or dual-boot setup.
How to Install Windows Subsystem for Linux
There was a time when Windows was completely separate and different from Linux. Windows used to think of Linux as their competitor. But the time has changed, and Windows realized that no user could get the actual feeling and knowledge of computing without learning Linux. Finally, in 2016 Windows came up with an arrangement where traditional Windows users can use the command-line interface of the Linux shell. That conjugated system is known as the Windows Subsystem for Linux (WSL). You can install the windows subsystem for Linux alongside your Windows system to use the command-line based Linux tools, software, and other tasks that were not possible to run on Windows.
WSL1 vs. WSL2?
The windows subsystem for Linux (WSL) has two active versions. They are named WSL1 and WSL2. The WSL1 works better in older hardware configurations, and it gives a more smooth performance. On the other hand, the Linux kernel-based WSL2 supports Microsoft Hyper-V feature. The WSL1 and the WSL2 both have a functional framework that is compatible and enough to install the Linux kernel. If you have more than one virtual machine install on your system, in that case, you need to select the WSL2 to get the full support of the Linux kernel. If we look at the hardware configuration system, WSL1 and WSL2 can provide stable performance on low memory and cache support. Ultimately, the WSL2 supports the full Linux kernel compatibility, but the overall performance of WSL1 is better than the WSL2. The choice is yours, you have to choose between the WSL1 and WSL2 while you want to install the windows subsystem for Linux.
Prerequisites of Installing the WSL
Before you start the process of windows subsystem for Linux, make sure that your Windows system is upgraded at least to the build version 1607. It is recommended to update and upgrade the system up to the build version 2004 (20H2), which is the latest build version of Windows. The hardware architecture of your PC needs to be in the 64-bit version. You cant install the WSL on a 32-bit machine. Most importantly, you also need to have the administrative power of your system.
Step 1: Enable the WSL for your system
There are two methods of enabling the windows subsystem for Linux. The first method allows you to enable the WSL from the command prompt. And, the second method is mostly based on the graphical user interface settings. Here, we will cover both CMD and GUI-based methods of enabling the WSL on a Windows system.
Method 1: Enable Windows Subsystem for Linux by CMD
Here, you have to run your command prompt as an administrator. You can find the cmd tool on the search bar of your Windows menu. Then click on the run as administrator button. That will provide you the root privileges and work under the system32 directory.
Now, run the following command-lines given below on your command prompt to enable the WSL feature. This command will allow you to enable the WSL without restarting the system. The following command will active the Deployment Image Servicing and Management (DISM) on your Windows machine.
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
Method 2: Enable Windows Subsystem for Linux by GUI
In this method, you need to enter the Control Panel of your system, then find the Programs and Features section. From the Program and features section, select the Turn Windows Features On or Off. It will open a new dialogue box. From the dialog box, find the Windows subsystem for Linux and enable it. After you click on the Done button, it will ask you to restart your system.
Step 2: Install the Linux Kernel
To install the Linux kernel on your Windows machine, open the Microsoft Store and search for your desired distribution of Linux. Usually, Ubuntu, Kali Linux, SuSE Linux, and a few Linux distributions are available on the Microsoft store. To install the Linux kernel, just click on the Get button. The approximate size of the Ubuntu kernel for windows subsystem for Linux almost 450MB. It may take a while to be installed.
Step 3: Get Started With The Windows Subsystem for Linux
Once the installation of the Windows subsystem for Linux is done, you will get a notification on your system tray. You can directly click on the Open button from the Microsoft Store, or you can find the Ubuntu Linux from the Start menu of your Windows system. Once you click on Ubuntu, it will take you to the command prompt to finalize the installation process. In this step, you will be asked to set a username and a password to configure the Windows subsystem for Linux. Once you are done with your accounts configuration, it will show you your current version of your Linux distribution, IP configuration status, and other support links. Before you run the WSL commands, you may need to install the WSL tool on your system. Run the following command to get the WSL tool on your Windows Subsystem for Linux.
sudo apt install wslYou can also perform the following command-lines given below to check the release information and the details of the WSL.
lsb_release -a wsl -help wsl -l wsl
Final words
Installing the windows subsystem for Linux provides you the hardware virtualization to install the Linux kernel on your Windows system. It works on the sandbox method; thus, it doesnt affect your original operating system and doesnt slow down your computer. If you are a newcomer to Linux, the Windows subsystem for Linux could be a strong start.