How To Install Wsl

How To Install Wsl

Reading time1 min
#Technology#Development#Software#WSL#Linux#Windows

Mastering WSL Installation: A Step-by-Step Guide for Seamless Linux Integration on Windows

Forget wrestling with dual-boot setups or clunky VMs—discover how a mindful approach to installing WSL can transform your Windows machine into a versatile development powerhouse with native Linux capabilities.

Windows Subsystem for Linux (WSL) has revolutionized the way developers work on Windows machines by providing a genuine Linux environment without the complications of dual-boot setups or heavyweight virtual machines. If you’re a developer or a power user looking to leverage Linux tools directly on your Windows PC, mastering the WSL installation process is the first step. This guide will walk you through everything—from enabling WSL on your system to installing your preferred Linux distribution and essential tweaks to optimize your workflow.


Why Use WSL?

Before diving into installation, let’s understand what makes WSL so appealing:

  • Seamless Integration: Run Linux executables natively alongside Windows applications.
  • No Dual Boot: No need to partition drives or restart your machine.
  • Low Overhead: Unlike full VMs, WSL uses very little system resources.
  • Flexible: Access Linux command-line tools, utilities, and applications directly on Windows.

Step 1: Check Your Windows Version

WSL is supported on Windows 10 and 11, but the best experience comes with Windows 11 or Windows 10 version 2004 and above.

  • To check your Windows version:
    1. Press Win + R, type winver, and hit Enter.
    2. The popup will tell you the Windows version number.

Note: For WSL 2, you need Windows 10 version 1903+ with Build 18362+ or Windows 11.


Step 2: Enable WSL and Virtual Machine Platform

WSL 2, the latest version, requires the "Virtual Machine Platform" as a prerequisite.

Method 1: Using PowerShell (Recommended)

  1. Launch PowerShell as Administrator: Right-click Start > Windows PowerShell (Admin).

  2. Enter the following command to enable WSL and Virtual Machine Platform:

    dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
    dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
    
  3. Restart your computer to apply changes.

Method 2: Using GUI

  • Open Control Panel > Programs and Features > Turn Windows features on or off
  • Check Windows Subsystem for Linux and Virtual Machine Platform
  • Click OK and restart your PC.

Step 3: Set WSL 2 as Your Default Version

Once your machine restarts, set WSL 2 as the default for future Linux installations by running:

wsl --set-default-version 2

This ensures that any Linux distribution you install runs on the more powerful and efficient WSL 2.


Step 4: Install Your Preferred Linux Distribution

Now it’s time to pick and install a Linux distro! Microsoft Store offers several popular options:

  • Ubuntu
  • Debian
  • Fedora Remix
  • Kali Linux
  • openSUSE, and more

Step-by-step installation via Microsoft Store:

  1. Open Microsoft Store and search for your preferred Linux distro (Ubuntu is recommended for beginners).
  2. Click Get (or Install).
  3. Once installed, launch the app from the Start menu.

Step 5: Initialize Your Linux Distribution

On the first launch:

  • The distro will complete installation.
  • You will be prompted to create a new UNIX username and password.

Example:

Enter new UNIX username: devuser
Enter new UNIX password: ********
Retype new UNIX password: ********

Step 6: Update and Upgrade Your Linux System

It’s best practice to update your packages immediately after installation:

sudo apt update && sudo apt upgrade -y

This ensures your Linux environment is current and secure.


Step 7: (Optional) Install Windows Terminal for a Better Console Experience

Using the Windows Terminal app enhances your workflow with features like tabs, themes, and easier switching between multiple shells.

  • Download Windows Terminal from the Microsoft Store.
  • Open it and from the dropdown menu, you can open your installed Linux distro shells seamlessly.

Bonus Tips for a Smooth WSL Experience

  • Access Windows Filesystem from Linux: Your Windows drives are mounted under /mnt. For example, access your C drive inside WSL at /mnt/c/.

    cd /mnt/c/Users/yourname/Documents
    
  • Run Windows executables from Linux: Try running notepad.exe or explorer.exe directly from WSL.

  • Improve File Performance: Keep active projects inside your Linux filesystem (within your distro’s home folder) for faster IO performance.

  • Install GUI Apps: With WSLg (available on Windows 11), you can run Linux GUI apps natively.


Troubleshooting Common Issues

  • WSL 2 requires virtualization enabled: Check BIOS/UEFI settings to enable Intel VT-x or AMD-V.

  • Update WSL Kernel: Run

    wsl --update
    
  • Check WSL version for installed distros:

    wsl -l -v
    
  • Convert existing distro to WSL 2:

    wsl --set-version <DistroName> 2
    

Wrapping Up

Installing WSL transforms your Windows machine into a dynamic hybrid environment, letting you enjoy the best of Linux and Windows simultaneously. With this step-by-step guide, you’ll avoid common pitfalls and set up a robust Linux environment in minutes—no virtualization headaches required.

Start experimenting today—install WSL, pick your Linux distro, and unlock endless development possibilities right on your Windows PC!


Have questions? Feel free to comment below or share your WSL setup experience!