The Windows Subsystem for Linux (WSL 2) has completely changed the game for developers. It allows you to run a full Linux kernel alongside your Windows OS, giving you the best of both worlds: the familiar Windows interface and the powerful command-line tools of Ubuntu.
If you’ve been looking for a way to use Linux without the overhead of a virtual machine or the complexity of dual-booting, this guide is for you.
Why Choose WSL 2?
Unlike the original WSL, which translated Linux system calls into Windows calls, WSL 2 uses a real Linux kernel in a lightweight utility VM. This results in:
- Full System Call Compatibility: Run complex apps like Docker or databases natively.
- Faster File System Performance: Significantly quicker execution when working with Linux-based files.
- Seamless Integration: Access your Windows files from Linux and vice versa.
Pre-installation Checklist
Before we dive into the installation, make sure your system is ready:
- OS Version: You need Windows 10 (Version 1903, Build 18362 or higher) or Windows 11.
- BIOS/UEFI Settings: Virtualization must be enabled in your computer’s BIOS settings.
- Updates: Ensure your Windows installation is up to date via Windows Update.
To check your Windows version: Press Win + R, type winver, and hit Enter.
Step 1: Enable WSL Features
The Quick Method (Recommended)
For most modern Windows versions, you can enable everything with a single command.
- Open PowerShell as an Administrator, Search for “PowerShell” in the Start Menu (Right-click -> Run as Administrator).
- Run:
wsl --install - Restart your computer. This step is mandatory to apply the feature changes.
The Manual Method (For Older Builds)
If the command above doesn’t work, you can enable the features manually:
- Open PowerShell as Administrator and run:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestartdism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart - Set WSL 2 as the default version:
wsl --set-default-version 2 - Restart your computer.
Step 2: Installing Your Ubuntu Distribution
You have two main ways to install the Ubuntu OS itself.
Method A: Via Command Line
- Open PowerShell as Administrator.
- List available distributions:
wsl --list --onlineThis command displays a list of available Linux distributions.The following is a list of valid distributions that can be installed. The default distribution is denoted by ‘*’. Install using ‘wsl –install -d‘. NAME FRIENDLY NAME
Ubuntu Ubuntu
Debian Debian GNU/Linux
kali-linux Kali Linux Rolling
Ubuntu-18.04 Ubuntu 18.04 LTS
Ubuntu-20.04 Ubuntu 20.04 LTS
Ubuntu-22.04 Ubuntu 22.04 LTS Ubuntu-24.04 Ubuntu 24.04 LTS - Install your desired Ubuntu version (e.g., Ubuntu 24.04 LTS):
wsl --install -d Ubuntu-24.04 - You’ll see an indicator of the installation progress in the terminal:
Installing: Ubuntu 24.04 LTS [==========================72,0%========== ] - Use
wsl -l -vto see all your currently installed distros and the version of WSL that they are using:NAME STATE VERSION Ubuntu-20.04 Stopped 2 * Ubuntu-24.04 Stopped 2 - Upon completion, Ubuntu will launch, prompting you to create a UNIX username and password.
Method B: Via Microsoft Store
- Open the Microsoft Store and search for “Ubuntu”.
- Select the version you want (the latest LTS version is usually best for stability).
- Click Get or Install.

Step 3: Initial Setup and Configuration
Once the installation finishes, the Ubuntu terminal will open automatically.
- Create a User: You will be prompted to enter a UNIX username and password. (Note: This is separate from your Windows credentials).
- Verify the Version: Ensure you are running on the WSL 2 architecture. In PowerShell, run:
wsl --list --verboseIf the version shows ‘1’, you can upgrade it with:wsl --set-version Ubuntu-24.04 2.
Step 4: Post-Installation Best Practices
The first thing you should always do in a fresh Ubuntu install is update the package list and upgrade existing software:
sudo apt update && sudo apt upgrade -y
Pro Tip: Accessing Files Across Systems
- Windows files from Ubuntu: Navigate to
/mnt/c/Users/YourName/. - Ubuntu files from Windows: Open File Explorer and type
\\wsl$in the address bar.
Conclusion
Setting up Ubuntu on WSL 2 provides a robust development environment right on your Windows machine. Whether you’re a web developer, a data scientist, or just someone looking to learn Linux, WSL 2 is the most efficient way to get started.
Discover more from TCMHACK
Subscribe to get the latest posts sent to your email.
