How to set up a Linux development environment inside Windows
Setting up the Windows Subsystem for Linux (WSL) provides a full Linux development environment directly inside Windows.
Step 1: Install WSL 2 (Ubuntu)
Open PowerShell or Command Prompt as Administrator (right-click and select Run as administrator).
Run the following command:
shwsl --install(This command enables necessary features, downloads the Linux kernel, and installs Ubuntu by default.)
Restart your computer when prompted.
After restarting, a terminal window will open automatically to complete the Ubuntu installation.
Enter a username and password for your Linux environment when prompted:
textEnter new UNIX username: your_username New password: Retype new password:Note that the password is entered blindly and no characters are shown on the screen.
Step 2: Update Ubuntu Packages
Before installing software, ensure your package list and installed packages are up to date.
Open the Ubuntu app from your Start Menu.
Run the update command:
shsudo apt update && sudo apt upgrade -y
Step 3: Install and Configure Git
Git allows you to track code changes and connect to repositories like GitHub.
Install Git:
shsudo apt install git -yVerify installation:
shgit --versionConfigure your Git identity (replace
Your Nameandyour.email@example.comwith your actual name and email address):shgit config --global user.name "Your Name"git config --global user.email "your.email@example.com"
Step 4: Accessing Files Between Windows and Linux
WSL 2 operates on a Linux virtual filesystem, but both operating systems can access each other's files.
Accessing Linux files from Windows
Open File Explorer in Windows.
In the left sidebar, scroll down to Linux (or type
\\wsl$in the address bar).Alternatively, inside your Linux terminal, open the current directory in Windows File Explorer by typing:
shexplorer.exe .
Accessing Windows files from Linux
Your Windows drives are mounted inside Linux under /mnt/.
To navigate to your Windows C: drive, run the following command, replacing
YourWindowsUsernamewith your actual user name:shcd /mnt/c/Users/YourWindowsUsername/Best Practice: Always keep your project source code files inside the Linux filesystem (e.g., in
/home/username/projects/). Storing project files directly in Linux offers significantly faster performance than working across/mnt/c/.
Step 5: Set Up Visual Studio Code for WSL
VS Code lets you edit Linux files seamlessly from Windows.
Download and install VS Code on Windows (not inside Linux).
Open VS Code, go to the Extensions tab (
Ctrl + Shift + X), search for WSL, and install the extension by Microsoft.Open your Linux terminal, navigate to a project directory, and launch VS Code:
shcode .VS Code will install the WSL server components automatically and open the workspace.
Step 6: Install and Configure Docker Desktop
Download and install Docker Desktop for Windows.
During installation, check the box for Use WSL 2 instead of Hyper-V.
Launch Docker Desktop after installation.
Open Docker Desktop Settings > Resources > WSL Integration.
Enable integration with your Ubuntu distribution and click Apply & restart.
Verify Docker works in your Ubuntu terminal:
shdocker --version docker run hello-world
Step 7: Install uv
uv is an extremely fast, single-binary Python package and project manager that can handle package installation, virtual environments, and dependency management.
Open your Ubuntu terminal.
Install uv using the official installer script:
curl -LsSfhttps://astral.sh/uv/install.sh| shRestart your terminal, or reload your shell configuration:
shsource ~/.bashrcVerify the installation:
shuv --version
Running web servers or Jupyter Lab inside Linux
WSL 2 automatically forwards all localhost ports from Linux to Windows, so any web server running inside Linux—whether Node/Vite, an Nginx container, or Jupyter Lab—is immediately accessible in your Windows browser at http://localhost:<port>.