Windows Subsystem for Linux

Cerulean CloudCerulean Cloud
2 min read

What is WSL?

Windows Subsystem for Linux is a Windows feature that allows you to run a Linux environment without using a separate virtual machine. WSL leverages Hyper-V - a Microsoft hypervisor to spin up the environment without needing a separate Virtual Machine.

What is the need for WSL?

Windows has an amazing UI but a bad development environment. Linux, on the other hand, has some good development tools. Especially in Cloud and DevOps, where “automating everything” is part of the role, the ability to write scripts without switching between two machines can enhance productivity.

Installing various Windows Command Prompt modules and tools has always been a pain for me. Linux is straightforward. That is also one major reason why I prefer working on Linux terminals.

Installing Windows Subsystem for Linux

  • Open PowerShell as Administrator: Search for PowerShell in the Start Menu, right-click it, and select Run as Administrator.

  • Run the WSL Installation Command: Enter the following command in PowerShell to enable WSL and install the default Linux distribution (usually Ubuntu):

  •       wsl --install
    
  • Run the WSL Installation Command: Enter the following command in PowerShell to enable WSL and install the default Linux distribution (usually Ubuntu):

  • Launch Your Linux Distro: After the restart, open your Start Menu and search for your newly installed Linux distribution (e.g., Ubuntu). Click to launch it.

  • Complete Initial Setup: When you open the Linux distribution for the first time, it may take a few moments to complete its setup. You'll be prompted to create a username and password.

  • Verify the Installation: Once logged in, check that everything is working by running a simple command, like:

  •     uname -a
    

    Check if Your System Supports WSL 2: WSL 2 requires Windows 10 Version 1903 or higher with Build 18362 or higher.

  • Install the Virtual Machine Platform: Open PowerShell as Administrator again and run:

      powershellCopy codedism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
    
  • Set WSL 2 as the Default Version:

      powershellCopy codewsl --set-default-version 2
    

If you want to try other distributions, you can do so by opening the Microsoft Store, searching for Linux or WSL, and choosing additional distributions to install.

0
Subscribe to my newsletter

Read articles from Cerulean Cloud directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Cerulean Cloud
Cerulean Cloud