The New Way of Using Linux Seamlessly in Windows by WSL
Tags: linux, operatingsystem, windows, wsl
Published: 2021-03-23 15:17:20


Run Linux Kernel inside Windows without third-party softwares like VMWare, Virtual Box etc by **Windows Subsytem for Linux**

![Image by Author](https://cdn-images-1.medium.com/max/4000/1*Y9EGVV-pluZXc7mWzc2jxg.png)

There is a very popular notion that Linux is the best OS for software development but Windows is more easy and comfortable to use. That must have made many of you to wonder if there were some way to **run Linux Kernel below Windows GUI**. If we could achieve this, we would get **BEST of Windows and Linux in a single OS.**

Turns out that there is one way to do this — **WSL (Windows Subsytem for Linux)**

## How is WSL different than Dual Booting OR running a virtualization software ?

**WSL vs Dual Booting**

* Dual Booting means installing multiple operating systems on a single computer, and being able to choose which one to boot.

* This means that you **CANNOT** run both the OS at the same time.

* But if you use WSL, you can use **both the OS simultaneously** without the need to switch the OS.

**WSL vs Virtualization Software**

* There are many virtualization software available in the market today. Some of the most popular ones are Virtual Box, VMWare etc. Some of you may have even used one of them.

* When you use VMWare or Virtual Box, you can run Linux (with GUI) inside Windows but **it takes a lot of time to load**. Also, if you need to access files stored in the main OS or internet from within the Virtual Machine (Guest OS), you **need to install multiple drivers** which makes it a very complex process.

* WSL2 solves all of this. It takes **less than a second** **to load** the Linux Kernel. The process is same as opening CMD or PowerShell in Windows. Moreover, the file mounting/sharing, command running, and networking between your Windows desktop environment and the WSL2 environment is seamless and nearly instant on launch. You **do not have to manage this environment** — it will update alongside Windows.

* Moreover, **if you use WSL, you can use programs installed on Windows from the Linux kernel**. One such example is VS Code. You can execute the command *code file_name *from the Linux Kernel to open a file in VS Code (which is installed in Windows).

## How WSL looks ?

If you are a guy who believes more in seeing stuff rather than reading about that stuff, you can have a look at the photo mentioned below.

![Running Linux using WSL on Windows](https://cdn-images-1.medium.com/max/3840/1*RhKNSqmaA399itcbk0spbA.png)

In the above image, you can see that a linux terminal is running on a windows PC just like Windows PowerShell.

## How to Install WSL?

In this article, we will tell you how to enable WSL2 and **install a Linux Distro of your choice**. WSL 2 is the latest version of WSL and is even better. To know more, you can visit this Microsoft Docs [link](https://docs.microsoft.com/en-us/windows/wsl/compare-versions).

To install WSL 2, we will install WSL first and then upgrade to WSL 2.

There are two options available for installing Windows Subsystem for Linux (WSL):

 1. [Simplified install](https://docs.microsoft.com/en-us/windows/wsl/install-win10#simplified-installation-for-windows-insiders) (preview)

* Executing the command — wsl --install on a powershell terminal will install WSL without any additional steps. But this command requires that you join the [Windows Insiders Program](https://insider.windows.com/getting-started) and install a preview build of Windows 10 (OS build 20262 or higher).

2. [Manual install](https://docs.microsoft.com/en-us/windows/wsl/install-win10#manual-installation-steps):

* The manual install steps can be used on **any version of Windows 10**.

## Manually Installing WSL 2

### Step 1 — Enable the Windows Subsystem for Linux

* We must first enable the “Windows Subsystem for Linux” optional feature.

* Run PowerShell as Administrator and execute the following command:

    dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

**This command may take anywhere between 40–90 minutes to run**. Moreover, not much will be output to the terminal when this command is getting executed. Hence, you must wear patience caps when you execute this command :)

* Do NOT restart the PC at this stage.

### Step 2 — Check requirements for running WSL 2

To update to WSL 2, you must be running Windows 10.

* For x64 systems: Version 1903 or higher, with Build 18362 or higher.

* For ARM64 systems: Version 2004 or higher, with Build 19041 or higher.

* Builds lower than 18362 do not support WSL 2. Use the [Windows Update Assistant](https://www.microsoft.com/software-download/windows10) to update your version of Windows.

### Step 3 — Enable Virtual Machine feature

* Before installing WSL 2, we must enable the Virtual Machine Platform optional feature.

* Run PowerShell as Administrator and execute:

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

Restart your machine to complete the WSL install and update to WSL 2.

### Step 4 — Download the Linux kernel update package

* Download the latest package using the following link — [WSL2 Linux kernel update package for x64 machines](https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi) . **If you’re using an ARM64 machine, please download the [ARM64 package](https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_arm64.msi) instead.** If you’re not sure what kind of machine you have, open Command Prompt or PowerShell and enter: systeminfo | find "System Type".

* Run the update package downloaded in the previous step. (Double-click to run — you will be prompted for elevated permissions, select ‘yes’ to approve this installation.)

### Step 5 — Set WSL 2 as your default version

Run PowerShell and execute this command to set WSL 2 as the default version when installing a new Linux distribution:

    wsl --set-default-version 2

### Step 6 — Install your Linux distribution of choice

Open the Microsoft Store and select your favorite Linux distribution. The following links will open the Microsoft store page for each distribution:

* [Ubuntu 16.04 LTS](https://www.microsoft.com/store/apps/9pjn388hp8c9)

* [Ubuntu 18.04 LTS](https://www.microsoft.com/store/apps/9N9TNGVNDL3Q)

* [Ubuntu 20.04 LTS](https://www.microsoft.com/store/apps/9n6svws3rx71)

* [openSUSE Leap 15.1](https://www.microsoft.com/store/apps/9NJFZK00FGKV)

* [SUSE Linux Enterprise Server 12 SP5](https://www.microsoft.com/store/apps/9MZ3D1TRP8T1)

* [SUSE Linux Enterprise Server 15 SP1](https://www.microsoft.com/store/apps/9PN498VPMF3Z)

* [Kali Linux](https://www.microsoft.com/store/apps/9PKR34TNCV07)

* [Debian GNU/Linux](https://www.microsoft.com/store/apps/9MSVKQC78PK6)

* [Fedora Remix for WSL](https://www.microsoft.com/store/apps/9n6gdm4k2hnc)

* [Pengwin](https://www.microsoft.com/store/apps/9NV1GV1PXZ6P)

* [Pengwin Enterprise](https://www.microsoft.com/store/apps/9N8LP0X93VCP)

* [Alpine WSL](https://www.microsoft.com/store/apps/9p804crf0395)

Once the distribution’s page is opened on the Windows Store, select Get to install that distribution.

The first time you launch a newly installed Linux distribution, a console window will open and you’ll be asked to wait for a minute or two for files to de-compress and be stored on your PC. All future launches should take less than a second.

You will then need to [create a user account and password for your new Linux distribution](https://docs.microsoft.com/en-us/windows/wsl/user-support).

![](https://cdn-images-1.medium.com/max/2696/0*Vg0ytkrasTPb4VKj.png)

## CONGRATULATIONS!

You’ve successfully installed and set up a Linux distribution that is completely integrated with your Windows operating system!

We would also recommend that **you should install Windows Terminal**. It is **completely optional** but would enhance your experience with WSL significantly.

 <iframe src="https://medium.com/media/5037f1cf1d8fe32a8c07c06a2bab37e3" frameborder=0></iframe>

Windows Terminal **enables multiple tabs** (quickly switch between multiple Linux command lines, Windows Command Prompt, PowerShell, Azure CLI, etc.), **create custom key bindings** (shortcut keys for opening or closing tabs, copy+paste, etc.), **use the search feature**, and **custom themes** (color schemes, font styles and sizes, background image/blur/transparency).

You can visit the following [link](https://docs.microsoft.com/en-us/windows/terminal/) to Learn more about Windows Terminal

To know how to install Windows Terminal, you can visit this [link](https://docs.microsoft.com/en-us/windows/terminal/get-started)