Overview
WSL 2 is an official tool that allows the use of Linux operating systems on Windows 10/11 without the need for a virtual machine or dual boot. Microsoft offers various Linux operating systems that run natively on WSL 2 for free in the Windows Store. This enables developers to set up a native Linux-based development environment without any cumbersome process or performance degradation.
Features
- The
WSL 2 architecture provides the best Linux environment performance within the Windows ecosystem because it is based on a lightweight VM with a Linux kernel directly produced by Microsoft, in official collaboration with various Linux vendors to provide WSL distros.
- Unlike Cygwin, which mimics Linux as closely as possible, it allows the use of binaries exactly the same way in a real Linux shell. (This is especially welcome for developers, as it allows the use of numerous tools that enhance productivity within the powerful Linux ecosystem. Microsoft officially states that WSL 2 was designed for developers.)
- File system access between Windows and WSL distros is possible. In Windows, it is accessible via
\wsl$ and in WSL distros via the /mnt path. (In any case, accessing the opposite file system reduces I/O performance. The best performance is shown when accessing the ext4 file system within the WSL distro. Therefore, in my case, both the IDE and source code are installed within the WSL distro.)
Prerequisites
Installing Ubuntu on WSL
Ubuntu is the most popular Linux operating system providing a desktop environment. It is officially available on the Windows Store, and you can click here to install the latest LTS version as an app. (Upon first launch after installation, it asks for a username and password to use.) Alternatively, it can also be installed from the console as follows.
$ wsl --install -d ubuntu
$ wsl --set-version ubuntu 2
$ wsl --unregister Ubuntu
Docker Integration
- Installing
Docker Desktop on Windows allows for the free use of Docker in Ubuntu on WSL.
$ choco install docker-desktop -y
- To use Docker within the installed Ubuntu console, the following steps are needed.
→ Settings
→ Resources
→ WSL Integration
→ Enable integration with additional distros: Activate [Ubuntu]
→ Click [Apply & Restart]
Settings
→ Tools
→ Terminal
→ Shell path: Enter [ubuntu run]
Running Ubuntu on WSL Console
- Running Ubuntu on Windows is very straightforward. Just execute the
ubuntu command. If Windows Terminal is installed, it automatically recognizes it, so setting it as the default profile is convenient.
$ ubuntu
$ ubuntu run
$ sudo nano /etc/wsl.conf
[network]
generateResolvConf = false
$ sudo nano /etc/resolv.conf
nameserver 1.1.1.1
nameserver 8.8.8.8
nameserver 208.67.222.222
$ sudo nano /etc/sysctl.d/99-wsl.conf
net.core.somaxconn=65535
net.ipv4.tcp_max_syn_backlog=65536
fs.inotify.max_user_watches=524288
fs.file-max=2097152
vm.swappiness=10
vm.vfs_cache_pressure=50
$ sudo sysctl --system
$ sudo apt-get update
$ sudo apt-get upgrade -y
Running Windows Applications from Ubuntu on WSL Console
- Conversely, it's also possible to run Windows applications from the WSL 2 console.
$ powershell.exe start notepad foobar.txt
$ nano ~/.bash_aliases
alias cmd="powershell.exe start"
$ cmd notepad foobar.txt
Increasing WSL Memory Size
- Increasing the memory size can make the development environment faster and more pleasant.
$ wsl --shutdown
$ notepad "$env:USERPROFILE/.wslconfig"
[wsl2]
memory=24GB
networkingMode=mirrored
$ Get-Service LxssManager | Restart-Service
(Optional) Installing JetBrainsMono Nerd Font
JetBrainsMono Nerd Font is a font specifically designed and optimized for terminal and coding environments, offering excellent readability and compatibility with various development tools. I highly recommend installing it for an enhanced coding experience. [Related Link]
→ https://www.nerdfonts.com/font-downloads
→ Search for "JetBrainsMono"
→ Click [Download]
→ Select all downloaded .ttf files → Right-click → [Install]
→ Settings → Profiles → Ubuntu → Appearance
→ Font face: [JetBrainsMono Nerd Font]
→ Font size: [10]
→ Line height: [1.2]
→ Click [Save]
(Optional) Installing Themes to Windows Terminal
Snazzy is a popular terminal color scheme that provides visual elegance and high readability through its dark theme, high contrast, and vibrant colors. You can add this theme to Windows Terminal as follows: [Related Link]
Windows Terminal
→ Settings → Open JSON file
"schemes":
[
{
"background": "#282828",
"black": "#282828",
"blue": "#458588",
"brightBlack": "#928374",
"brightBlue": "#83A598",
"brightCyan": "#8EC07C",
"brightGreen": "#B8BB26",
"brightPurple": "#D3869B",
"brightRed": "#FB4934",
"brightWhite": "#EBDBB2",
"brightYellow": "#FABD2F",
"cursorColor": "#EBDBB2",
"cyan": "#689D6A",
"foreground": "#EBDBB2",
"green": "#98971A",
"name": "Gruvbox Dark",
"purple": "#B16286",
"red": "#CC241D",
"selectionBackground": "#3C3836",
"white": "#A89984",
"yellow": "#D79921"
},
{
"background": "#282A36",
"black": "#282A36",
"blue": "#57C7FF",
"brightBlack": "#686868",
"brightBlue": "#57C7FF",
"brightCyan": "#9AEDFE",
"brightGreen": "#5AF78E",
"brightPurple": "#FF6AC1",
"brightRed": "#FF5C57",
"brightWhite": "#EFF0EB",
"brightYellow": "#F3F99D",
"cursorColor": "#97979B",
"cyan": "#9AEDFE",
"foreground": "#EFF0EB",
"green": "#5AF78E",
"name": "Snazzy",
"purple": "#FF6AC1",
"red": "#FF5C57",
"selectionBackground": "#3E404A",
"white": "#F1F1F0",
"yellow": "#F3F99D"
}
],
# After adding the scheme, apply it in Windows Terminal
→ Settings → Profiles → Ubuntu → Appearance → Color scheme → [Snazzy]
→ Click [Save]
(Optional) Installing Starship
Starship is a cross-platform terminal prompt customization tool that provides a modern shell prompt solution with fast performance based on Rust and compatibility with various shells. [Related Link]
$ curl -sS https://starship.rs/install.sh | sh
$ nano ~/.bashrc
eval "$(starship init bash)"
$ source ~/.bashrc
$ starship preset gruvbox-rainbow -o ~/.config/starship.toml
(Optional) Installing eza
eza is a modern, high-performance file listing tool written in Rust that replaces and extends the traditional ls command. I highly recommend installing it for enhanced file system navigation. [Related Link]
$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
$ source $HOME/.cargo/env
$ rustup update
$ cargo install eza
$ nano ~/.bash_aliases
alias ls="eza --icons --group-directories-first"
alias ll="eza -lah --icons --git --group-directories-first"
alias lt="eza -lah --icons --git --group-directories-first --tree --level=2"
alias la="eza -a --icons --group-directories-first"
alias l="eza -F --icons --group-directories-first"
(Optional) Installing OpenJDK 21
- Install
OpenJDK 21 in the development environment as follows. (For convenience, SDKMAN was used.)
$ curl -s "https://get.sdkman.io" | bash
$ source "$HOME/.sdkman/bin/sdkman-init.sh"
$ sdk i java 21.0.8-amzn
$ sdk default java 21.0.8-amzn
$ sdk current java
Using java version 21.0.8-amzn
$ java --version
openjdk 21.0.8 2025-07-15 LTS
(Optional) Installing Node.js
- In the Ubuntu environment, Node.js can be conveniently managed by installing
NVM. [Related Link]
$ cd ~
$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
$ source ~/.bashrc
$ nvm list-remote
$ nvm install 20.11.0
$ node --version
v20.11.0
$ npm --version
10.2.4
(Optional) Installing AWS CLI v2
$ cd ~
$ curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
$ unzip awscliv2.zip
$ sudo ./aws/install
$ nano ~/.bash_aliases
alias aws="/usr/local/aws-cli/v2/current/bin/aws"
$ aws --version
aws-cli/2.14.0 Python/3.11.6 Linux/5.15.133.1-microsoft-standard-WSL2 exe/x86_64.ubuntu.22 prompt/off
$ sudo apt install python3-pip -y
$ pip install awslogs
$ aws configure
AWS Access Key ID [None]:
AWS Secret Access Key [None]:
Default region name [None]:
Default output format [None]:
(Optional) Installing Other Useful Utilities
- Below are examples of useful utilities when using the Ubuntu console. [Related Link]
$ sudo apt-get install zsh jq httpie neofetch ranger nmap -y
$ npm install -g tldr
$ cd ~
$ git clone git://github.com/wting/autojump.git
$ cd autojump
$ ./install.py
$ source /home/jsonobject/.autojump/etc/profile.d/autojump.sh
References
Further Reading