Windows 10/11 | WSL & VS Code Setup v1.0
Welcome to your one-stop guide for transforming a fresh Windows installation into a productive development workstation. In this guide, we’ll cover everything from installing the Windows Subsystem for Linux (WSL) to setting up Visual Studio Code (VS Code) for a seamless development experience. Whether you’re diving into AI, research, or just need a robust setup for coding, follow along step-by-step.
- Introduction
- Prerequisites
- Step 1: Setting Up WSL
- Step 2: Troubleshooting WSL
- Step 3: First Actions in WSL
- Step 4: Setting Up VS Code with WSL
- Step 5: Exporting & Installing Extensions (Optional)
- Conclusion
Starting from scratch can be both exciting and challenging. This guide is designed to help you quickly transform a new PC into a powerful development environment. We’ll use the Windows Subsystem for Linux (WSL) with Ubuntu 22.04 for a Linux-like experience and VS Code for a modern, robust coding interface.
- Operating System: Windows 10 or Windows 11
- Internet Connection: Required for downloads and updates
- Administrator Access: Needed for installing WSL and other system changes
WSL (Windows Subsystem for Linux) lets you run a Linux environment directly on Windows without the overhead of a virtual machine. We will use Ubuntu 22.04 as our Linux distribution.
Open PowerShell as an administrator and check if WSL is already installed by running:
wsl --list --verboseIf Ubuntu 22.04 is not installed, run the following command:
wsl --install -d Ubuntu-22.04To ensure that Ubuntu 22.04 is your default WSL distribution, execute:
wsl --set-default Ubuntu-22.04After setting the default, you can verify by listing distributions again:
wsl --list --verboseOnce installed, simply type:
wslThis will open your Ubuntu terminal within WSL.
If you encounter issues or need to remove the current Ubuntu 22.04 installation, you can terminate and unregister it. Warning: Unregistering will delete all data for that distribution.
Terminate the running instance:
wsl --terminate Ubuntu-22.04Then unregister (remove) the distribution:
wsl --unregister Ubuntu-22.04Before diving into development, it’s essential to update your package lists:
sudo apt-get updateThis command fetches the latest package information and ensures your system is up-to-date.
Visual Studio Code (VS Code) provides a powerful and flexible code editor that integrates seamlessly with WSL.
-
Download & Install VS Code:
Visit the official VS Code website and install the latest version for Windows. -
Install the "Remote - WSL" Extension:
- Open VS Code.
- Go to the Extensions view by pressing
Ctrl+Shift+X. - Search for Remote - WSL.
- Click Install.
With the Remote - WSL extension installed, you can now launch VS Code from within your Ubuntu terminal:
-
Open your Ubuntu terminal (WSL).
-
Navigate to your project directory or where you want to work.
-
Run the following command:
code .
This command opens the current directory in VS Code. You’ll notice a WSL indicator in the bottom left corner, confirming that VS Code is connected to your Linux environment.
To keep your VS Code extensions synchronized between machines:
-
Export Extensions from Your Old Setup:
code --list-extensions > extensions.txt -
Install Extensions on Your New Machine:
Create a script (e.g.,
install_extensions.sh) with the following content:#!/bin/bash while read extension; do code --install-extension "$extension" done < extensions.txt
Make the script executable and run it:
chmod +x install_extensions.sh bash install_extensions.sh
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
sudo apt upgrade
Install Python 3.12 and Pip:
sudo apt install python3.12 python3.12-dev python3-pip python3.12-venv -y
Set Python 3.12 as the Default Version:
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.12 1
Verify the Python version:
python --version
-
Create a new virtual environment (let’s call it
.venv):python -m venv .venv
-
Activate the virtual environment:
- On Linux/macOS:
source .venv/bin/activate - On Windows:
.venv\Scripts\activate
- On Linux/macOS:
For development we suggest also install (optional):
pip install ipykernel
Open the terminal and run:
node -vThis will display the currently installed version.
If you installed Node.js using apt, remove it first:
sudo apt remove -y nodejs
sudo apt purge -y nodejs
sudo apt autoremove -y- Add Node.js 20 Repository
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - - Install Node.js
sudo apt install -y nodejs
- Verify the Installation
It should now show
node -v
v20.x.x.
You can install git using winget tool Install winget tool if you don't already have it, then type this command in command prompt or Powershell.
winget install --id Git.Git -e --source wingetor simple download the application here. https://git-scm.com/downloads/win
sudo apt update
sudo apt install dos2unix
Congratulations! You’ve now set up a full development environment on your new Windows PC using WSL and VS Code. This guide has provided a clear path from installing Ubuntu 22.04 under WSL to getting your favorite code editor up and running. Whether you’re developing AI applications, researching, or simply coding for fun, this setup lays a robust foundation for productivity.
Happy Setup & Happy Coding!





