Setting Up WSL on Windows: A Practical Guide for Software Engineers

Setting Up WSL on Windows: A Practical Guide for Software Engineers

From early on in my undergrad days, trying to set up programming environments on Windows was always frustrating. Things never quite worked the way the Linux tutorials said they would. So I shifted to Linux — and for a long time, it remained my default OS for all serious development. I even had a dual-boot setup, using Linux for coding and Windows only when I absolutely had to.

But everything changed when WSL 2 (Windows Subsystem for Linux) launched.

It wasn’t just about WSL 2 being a technical improvement — it was also the timing. Around that period, I found myself using more non-programming apps day to day: Zoom and Teams for meetings, Slack and WhatsApp (which honestly felt nicer on Windows), a few productivity tools that were Windows-only, and I still wanted the option to casually play games or use Adobe tools. Constantly rebooting between Linux and Windows just to switch contexts started to wear me down.

That’s when I gave WSL 2 a proper try. And honestly — it felt like using the best of both worlds. I could stay in Windows, run Linux commands natively, use the same bash scripts and tools I used on actual servers, and build, test, or deploy like I would on a production Linux machine. For general software engineering work — whether it's scripting, building applications, working with Docker, testing APIs, or doing DevOps — WSL 2 has been a game-changer for development on Windows.

A Quick Note on Storage: C Drive vs Others

One thing I learned early is that WSL stores your Linux distributions in the C drive by default. That’s important, because the performance of WSL (especially WSL 2) is tightly coupled with disk I/O speed. The C drive is managed and optimized by Windows for this kind of integration.

While you can install and use WSL from another drive (like D: or E:), I’d recommend keeping at least 10–20 GB of free space in C — especially if you’re going to install large tools, compilers, or databases.

Also, try to avoid working directly inside /mnt/d, /mnt/e, or other mounted drives — file access is noticeably slower there. Instead, do your development inside your WSL home directory (e.g., ~/projects) and move files in and out as needed.

Step 1: Check Windows Version

  • WSL 2 requires Windows 10 (version 2004 and higher, Build 19041+), or Windows 11.
  • To check your version: Press Win + R, type winver, and press Enter.
  • Make sure your build number is supported. If needed, update via Windows Update or download the Windows 10 Update Assistant.

Step 2: Enable WSL and Virtual Machine Platform

If you're using Windows 11, WSL setup is simple. Open PowerShell as Administrator and run:

wsl --install

This will:

  • Enable the required Windows features
  • Set WSL 2 as the default
  • Download and install Ubuntu

If you're on Windows 10, or prefer manual setup, run:

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

Then restart your computer.

Step 3: Install WSL 2 Kernel (if required)

On older systems or Windows 10, you may need to manually install the WSL 2 kernel:

Once installed, set WSL 2 as the default version:

wsl --set-default-version 2

Step 4: Install a Linux Distribution

Head to the Microsoft Store, search for a Linux distro, and install it. Common options include:

  • Ubuntu 22.04 LTS (recommended)
  • Debian
  • Kali Linux

Once installed, launch it from the Start Menu or by typing:

wsl

On the first launch, you’ll be asked to create a UNIX username and password. This is your Linux environment, separate from your Windows credentials.

Step 5: Set Up the Linux Environment

Update and upgrade the packages:

sudo apt update && sudo apt upgrade -y

Install some common development tools:

sudo apt install build-essential curl git unzip -y

You're now ready to use the terminal just like on any regular Linux system.

Step 6: File Access and Interoperability

  • From Linux, you can access Windows files at /mnt/c/Users/<your-username>/
  • From Windows, access Linux files at: \\wsl$\Ubuntu\

You can also launch VS Code directly in your WSL environment if you have the Remote WSL extension:

code .

This opens the current WSL folder in VS Code.

Step 7: Set a Default Distro (if using multiple)

To list installed distributions:

wsl --list --verbose

To set one as default:

wsl --set-default Ubuntu

You can also run a specific distro with:

wsl -d Ubuntu

Step 8: (Optional) Configure .wslconfig

You can fine-tune WSL 2 resource usage by creating a .wslconfig file in your Windows home directory:

C:\Users\<YourUsername>\.wslconfig

Example configuration:

[wsl2]
memory=4GB
processors=2
swap=2GB
localhostForwarding=true

Restart WSL for changes to take effect:

wsl --shutdown

Common Troubleshooting Tips

ProblemSolution
wsl --install not recognizedMake sure you're using PowerShell as Admin and on Windows 10 2004+
Linux not accessing internetRun wsl --shutdown and restart the WSL terminal
File access is slowAvoid working directly inside /mnt/c or other mounted drives
VS Code WSL not connectingEnsure the Remote - WSL extension is installed in VS Code

Conclusion

WSL 2 has significantly improved the development experience on Windows — especially for those of us who previously relied on dual boot or clunky virtual machines to get access to a proper Linux shell. Today, you can run a full-featured Linux environment inside Windows with minimal setup, minimal friction, and surprisingly good performance.

For software engineers working across multiple domains — backend, scripting, tooling, automation, DevOps, data — having WSL installed is like having a native Linux terminal that integrates smoothly with your daily Windows workflow.

References

You can find my Resume here!

My Resume