Menu Close

How to enable Linux features on Windows with WSL

Being an IT administrator, we often interact with Linux machines for our databases and applications and one thing we do to connect these machine is, using SSH from our windows machine. Now there are many tools available for that like puTTY, MobaXterm, gitbash, etc., but Microsoft also have an inbuilt capability for this called WSL or Windows Subsystem for Linux. Not just SSH, it will provide you a complete 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.

WSL is developed by Microsoft and Canonical (Ubuntu’s parent company). Recently WSL 2 is released providing better file system and system call compatibility. You can switch between WSL 1 and 2 any time once installed with one command.

Requirements

Both version on WSL only supports Windows 10 64 bit and Windows Server 2019, however, WSL-1 need Windows Build 16215 or later and WSL-2 require Windows Builds 19041 or above. Check your Windows version by selecting the Windows logo key + R, type winver, select OK. (Or enter the ver command in Windows Command Prompt). You can also check build version by opening powershell and executing below command.

systeminfo | Select-String "^OS Name","^OS Version"

Installation of WSL 2

Click windows button and search “Turn Windows features on or off“. Click ‘Windows Subsystem for Linux’ and ‘Virtual Machine Platform’ (VM platform is required for WSL2 only). Click OK and this will require a reboot after that. 

You can run those action from Powershell also with below commands and restart after that.

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

After restart, download and install WSL 2 Linux Kernel package from this link

You need to use WSL 2 by default to leverage all its features, for that run below command on Command Prompt.

wsl --set-default-version 2

 

Installing Linux distribution of choice on WSL.

Now that you have installed WSL you can run install any of your favorite Linux distro. Open Microsoft Store and search ‘Linux‘ and select your favorite distro (I chose Ubuntu’s latest version here).

Once installed click “Launch“. This will startup the Linux machine startup and ask to create a username and password and that’s all.

Quick Hands-On

WSL version check

wsl --list --verbose

Switch WSL versions

wsl --set-version <Linux-Distro> 1/2

I am using this WSL to access my Linux machines on Oracle Cloud.

~Thankyou for reading.

Leave a Reply

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