WSL2 window 10 developers environment
Tags: Dev Environment Setup, Dooboolab, Wsl 2, Ubuntu, Windows Subsystem Linux

I’ll share my developer environment using new WLS2 in windows 10.

Image from scotch.io

Microsoft has officially announced WSL2 and I’d like to use it in my windows PC and this is really awesome 💯.

Let’s go over how I’ve set this up and use in my labtop. By the way I am using dell xps 9700.

Firstly, run win + r and run winver to find out your Windows 10 version.

Your Windows 10 version must be higher than the Version 2004, Build 19041 . If not, you should update your Windows from Settings -> Windows Update . If you can’t find any updates although you are in lower version, you can try download the updates from the link.

After restarting your computer, you are ready to install WSL2. Actually the way to do is well written in the official Microsoft doc.

1. Open PowerShell as Administrator and run below

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

2. Enable the Virtual Machine Platform optional component

dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

3. Set WSL 2 as your default version

wsl --set-default-version 2

4. Open up Microsoft Store and select your favorite Linux distribution. I have installed Ubuntu which is 20.04 currently

5. After the installation, setup your Linux user

6. Run PowerShell with administrator again and write below command

wsl --set-version Ubuntu 2

7. Switch wsl to wsl2

wsl --set-default-version 2

Now you’ve gotten wsl2 in your computer if you did not have any troubles 🎉. Below are more setups I’ve had in my environment.

1. Install Windows Terminal

2. Open Windows Terminal and open settings.json

3. Look for the guid from the settings

4. Change the defaultProfile guid to Ubuntu .

You can also startingDirectory as below.

"startingDirectory" : "//wsl$/Ubuntu-20.04/home/<Your Ubuntu Username>"

5. Install zsh

sudo apt install zsh

6. Install oh-my-zsh

$ sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

I also recommend you to install zsh-syntax-highlighting

7. Remove ugly highlights when writing ls -l .

You can remove it by adding below in ~/.zshrc . Followed by the article.

LS_COLORS='ow=01;36;40'

export LS_COLORS

8. Install nvm

Run source ~/.zshrc after installation.

after installation. Also install stable node using nvm. nvm install stable .

9. Install yarn globally

npm install -g yarn

Export yarn global path in ~/.zshrc .

export PATH="$PATH:'yarn global bin'"

10. Install vscode

Also, update settings.json for vscode. Here are the settings in gist, I use currently.

11. Install plugins for vscode

Specific lists are listed below

DotENV

EsLint

Git History

GitLens

GraphQL Language Support

Import Cost

Live Share

Remote WSL

sort-imports

Vim

vscode-styled-components

Bracket Pair Colorizer 2

Lastly, I am going to tell you very important concept in WSL2. If you want to experience the dramatic performance gains using WSL2, you should place your sourcecode in Linux filesystem which will start with /home/{username} . If you put them in Windows filesystem which start with mnt/c/* , you will experience even worse performance compared to WSL1. Here is the issue with related discussion.

I really enjoy working with WSL2. Hope there are more users with my environment.

Thanks for reading 😄