Setting Up a Development Environment with WSL2 + Ubuntu + Git
What I Learned
I usually develop on a Mac, but recently I’ve had more opportunities to teach development to Windows users. So I organized the procedure for setting up a development environment on Windows. With the combination of WSL2 + Ubuntu + Git + VS Code, you can build a comfortable Linux development environment on Windows similar to Mac. It’s lighter than virtual machines and file sharing with Windows is smooth.
Details
0. Prerequisites
- Windows 10 (21H2 or later) or Windows 11
- User with administrator privileges
- Virtualization support (Intel VT-x / AMD-V) enabled in BIOS/UEFI
- Internet connection
1. WSL2 Setup
1-1. Installation
Run the following in PowerShell (Administrator):
1wsl --install
If prompted to restart, make sure to restart.
1-2. Confirm Ubuntu Installation
After restart, in PowerShell:
1wsl -l -v
If Ubuntu is not displayed, manually install:
1wsl --install -d Ubuntu
Or install “Ubuntu” from the Microsoft Store.
1-3. First Ubuntu Launch
On first launch, set:
- UNIX username
- Password
The Ubuntu terminal is now ready to use.
2. Ubuntu System Update
Run the following in the Ubuntu terminal:
1sudo apt update
2sudo apt upgrade -y
3. Git Installation
3-1. Install Git
1sudo apt install -y git
3-2. Git User Configuration
1git config --global user.name "Your Name"
2git config --global user.email "you@example.com"
Verify:
1git config --global --list
4. VS Code WSL Integration
4-1. Install VS Code
Install VS Code on the Windows side (download from the official site).
4-2. Install Extension
- Launch VS Code
- Open the Extensions icon
- Search for
Remote - WSL - Install
4-3. Verify WSL Connection
In the Ubuntu terminal:
1code .
If VS Code launches and WSL: Ubuntu is displayed in the lower left, it’s successful.
5. Create Development Directory
In the Ubuntu terminal:
1mkdir -p ~/dev
2cd ~/dev
Create project folder:
1mkdir myapp
2cd myapp
This becomes the project root.
6. Initialize Git Repository
6-1. Initialize Repository
1cd ~/dev/myapp
2git init
6-2. Create .gitignore
1nano .gitignore
Example content (minimum necessary):
# Python
.venv/
__pycache__/
# Node
node_modules/
# VS Code
.vscode/
# OS
.DS_Store
Save: Ctrl + O → Enter Exit: Ctrl + X
6-3. First Commit
1git add .
2git commit -m "first commit"
Completed Environment
The above procedure completes the following:
- WSL2 + Ubuntu setup
- Git available on Ubuntu side
- VS Code integrated with WSL
- Project directory prepared at
~/dev/myapp .gitignoreconfigured andgit initcompleted- Ready to introduce Python (uv) or Node.js as needed and start development
Advantages
- Lightweight: Less resource consumption than virtual machines
- Integration: Windows and Linux file systems work seamlessly together
- Development Efficiency: Linux toolchain can be used directly on Windows