Linux and WSL Setup Guide 2026: Complete Environment for Windows Developers
Set up a complete Linux development environment on Windows using WSL 2 in 2026. Terminal, package managers, Node.js, Python, Docker - everything configured step by step.
If you're a developer on Windows, WSL (Windows Subsystem for Linux) is the best thing that happened to your workflow. It gives you a full Linux environment right inside Windows - no dual boot, no virtual machines, no compromises.
This guide walks you through setting up WSL 2 from scratch in 2026, installing essential developer tools, and configuring everything so it works perfectly.
Why WSL 2 in 2026?
Most servers, deployment environments, and DevOps tools run Linux. Docker, Kubernetes, and CI/CD pipelines assume Linux. If you develop on Windows and deploy to Linux, you've probably hit compatibility issues.
WSL 2 solves this by running a real Linux kernel inside Windows:
- Full Linux compatibility - run bash scripts, Linux binaries, and server software natively
- Fast file system - WSL 2 uses a real ext4 file system, much faster than WSL 1
- Docker integration - Docker Desktop uses WSL 2 as its backend
- VS Code integration - edit files in WSL directly from VS Code
- No performance hit - near-native Linux performance for development tasks
- Runs alongside Windows - no rebooting, no virtual machine overhead
Installing WSL 2
Prerequisites
- Windows 10 version 2004+ or Windows 11
- Virtualization enabled in BIOS (usually on by default)
One-Command Install
Open PowerShell as Administrator:
wsl --install
This installs WSL 2 with Ubuntu by default. Restart your computer when prompted.
Choose a Different Distro
Want something other than Ubuntu?
# List available distros
wsl --list --online
# Install a specific one
wsl --install -d Debian
wsl --install -d Ubuntu-24.04
Verify Installation
After restart, Ubuntu will open automatically and ask you to create a username and password. Then verify:
wsl --version
lsb_release -a
Setting Up the Terminal
Windows Terminal (Recommended)
Windows Terminal is pre-installed on Windows 11. For Windows 10, install it from the Microsoft Store.
Configure it as your default terminal. It supports tabs, split panes, custom themes, and GPU-accelerated rendering.
Essential Terminal Settings
Open Windows Terminal settings (Ctrl+,) and set:
- Default profile: Ubuntu (or your WSL distro)
- Starting directory:
//wsl$/Ubuntu/home/yourusername - Font: JetBrains Mono or Cascadia Code (ligature support)
- Color scheme: One Half Dark or Dracula
Oh My Bash (Optional)
For a better-looking prompt:
bash -c "$(curl -fsSL https://raw.githubusercontent.com/ohmybash/oh-my-bash/master/tools/install.sh)"
Essential Developer Tools
Update System First
sudo apt update && sudo apt upgrade -y
Install Build Essentials
sudo apt install build-essential curl wget git unzip -y
Git Configuration
If you've followed our Git and GitHub beginners guide, you know the basics. Set up Git in WSL:
git config --global user.name "Your Name"
git config --global user.email "your@email.com"
git config --global core.autocrlf input
git config --global init.defaultBranch main
The core.autocrlf input setting is critical - it prevents Windows line-ending issues when working across WSL and Windows.
SSH Key for GitHub
ssh-keygen -t ed25519 -C "your@email.com"
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519
cat ~/.ssh/id_ed25519.pub
Copy the output and add it to your GitHub account → Settings → SSH Keys.
Installing Node.js
Using NVM (Recommended)
Never install Node.js with apt - use NVM for version management:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash
source ~/.bashrc
# Install latest LTS
nvm install --lts
nvm use --lts
# Verify
node --version
npm --version
Enable Corepack for pnpm/yarn
corepack enable
corepack prepare pnpm@latest --activate
Installing Python
sudo apt install python3 python3-pip python3-venv -y
# Verify
python3 --version
pip3 --version
# Create alias for convenience
echo "alias python=python3" >> ~/.bashrc
echo "alias pip=pip3" >> ~/.bashrc
source ~/.bashrc
Docker in WSL 2
Docker and WSL 2 work together perfectly. If you're following our Docker beginners guide, here's how to set it up on WSL:
Option 1: Docker Desktop (Easiest)
- Install Docker Desktop for Windows
- Go to Settings → General → enable "Use WSL 2 based engine"
- Go to Settings → Resources → WSL Integration → enable your distro
Now docker commands work directly from your WSL terminal.
Option 2: Docker Engine in WSL (No Desktop)
# Add Docker's official GPG key
sudo apt install ca-certificates curl gnupg
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
# Add the repository
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo $VERSION_CODENAME) stable" | sudo tee /etc/apt/sources.list.d/docker.list
# Install
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io -y
# Add your user to docker group
sudo usermod -aG docker $USER
VS Code + WSL Integration
This is where things get magical. Install the right VS Code extensions and then:
- Install the WSL extension in VS Code
- Open any project from WSL:
code .in your WSL terminal - VS Code opens with a remote connection to WSL
All extensions, terminal, and file operations now run inside Linux. You get the best of both worlds - Windows UI with Linux backend.
Recommended Workflow
# Store all projects inside WSL (not /mnt/c/)
mkdir -p ~/projects
cd ~/projects
git clone your-repo
code .
Important: Keep your code inside the WSL file system (~/projects), not on the Windows drive (/mnt/c/). File operations are 5-10x faster on the native Linux file system.
Database Setup
PostgreSQL
sudo apt install postgresql postgresql-contrib -y
sudo service postgresql start
# Create a user
sudo -u postgres createuser --interactive
# Answer the prompts
# Create a database
sudo -u postgres createdb mydb
MongoDB
# Import MongoDB public key
curl -fsSL https://www.mongodb.org/static/pgp/server-7.0.asc | sudo gpg --dearmor -o /usr/share/keyrings/mongodb-server-7.0.gpg
# Add repo and install
echo "deb [signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/7.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.list
sudo apt update
sudo apt install mongodb-org -y
sudo systemctl start mongod
Performance Optimization
WSL Memory Limit
WSL 2 can consume a lot of RAM. Create .wslconfig in your Windows home folder (C:\Users\YourName\.wslconfig):
[wsl2]
memory=4GB
processors=4
swap=2GB
Then restart WSL:
wsl --shutdown
File System Performance
- Always work inside
~/projects(Linux file system) - Avoid accessing
/mnt/c/for active development - Use
gitto sync files between systems if needed
Common Issues and Fixes
DNS Resolution Fails
echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf
Clock Drift
sudo hwclock -s
Service Won't Start
WSL doesn't use systemd by default. Enable it:
echo -e "[boot]\nsystemd=true" | sudo tee /etc/wsl.conf
Then restart WSL from PowerShell: wsl --shutdown
FAQ
Is WSL 2 as fast as native Linux?
For most development tasks, yes. File I/O on the Linux file system is near-native speed. The main performance difference is in GPU-heavy tasks.
Can I run GUI apps in WSL?
Yes. WSL 2 on Windows 11 supports Linux GUI apps natively through WSLg - you can run browsers, file managers, and even IDEs.
Should I use WSL or just install Linux?
If you need Windows for daily use (Office, Adobe, gaming), WSL gives you the best of both worlds. If you're fully committed to Linux, a native install is slightly faster.
Final Thoughts
WSL 2 turns Windows into a legitimate development machine. You get a real Linux environment without any dual-boot hassle, and the VS Code integration makes it feel completely native.
Set it up once, configure your tools, and you'll have a development environment that matches what most companies use in production. No more "works on my machine" problems.
Share this article
Written by
Ali RehmanAuthor at ByteVerse
A Full Stack Developer and Tech Writer specializing in React.js, Next.js, and modern JavaScript, sharing insights on web development, frontend technologies, backend APIs, and scalable applications.
View all posts