🐧 How to install Linux on Windows with WSL

The Windows Subsystem for Linux (WSL) lets developers install a Linux distribution (such as Ubuntu, OpenSUSE, Kali, Debian, Arch Linux, etc) and use Linux applications, utilities, and Bash command-line tools directly on Windows, unmodified, without the overhead of a traditional virtual machine or dualboot setup.


Install WSL Command

Open PowerShell or Windows Command

wsl --install
# or
wsl --list --online # For a valid list of distribution names
wsl --install -d <Distribution Name>

Add a User for WSL (Optional)

adduser <username>
usermod -aG sudo <username> # Add user to sudoers

Install Visual Studio Code

Download

Use Windows Proxy

Ubuntu version at least to be 22.04

In your %UserProfile% directory(use cd ~ to access your home directory, which is typically your user profile, C:\Users\<UserName>), create .wslconfig file, paste the following configurations into it:

[wsl2]
networkingMode=mirrored
autoProxy=true

After configured this, you need to run wsl --shutdown to stop WSL first, and then relaunch terminal

Install zsh

sudo apt install zsh
chsh -s $(which zsh) # Make zsh the default shell. Without sudo, if you use sudo it will change the shell not for your working user but for root
  1. Install oh-my-zsh
  2. Change theme

Install Homebrew

Homebrew on Linux

Useful Commands

explorer.exe . # Open current folder in windows

Additional Information

  1. Size: 72 x 20
  2. Theme: Campbell
  3. Opacity: 95%