How To Setup WSL on Windows 10 For Development

WSL is great to use if you are developing on Windows 10 - this is how you set it up.

Enable WSL

First, you need to enable WSL. Run the following command in Windows PowerShell.

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

Install a distro from the Microsoft Store

Choose a distro from the Microsoft Store to install - I use Ubuntu.

Update Linux

First time you access your WSL, make sure to update everything.

sudo apt-get update

Customize the Command Line Prompt

You can make changes to how your prompt is displayed by modifying the .bashrc file. Add one of the following lines to modify your prompt.

export PS1="\w$ " # full working dir
export PS1="\W$ " # basename of working dir
export PS1="\u@\W $ " # username @ working dir
export PS1="[\t] \u@\h:\w\$ " # timestamp + username + host + working dir

Install Oh My Zsh

I always install Oh My Zsh in my linux environment.

sudo apt install zsh
sh -c "$(curl -fsSL"

You can edit your zsh settings in the ~/.zshrc file.

code ~/.zshrc

These are some settings that I use.

# ...
plugins=(git nvm zsh-syntax-highlighting zsh-autosuggestions colorize brew)

Vs Code with WSL

You need to install the Remote WSL extension to use WSL in your VS Code environment.

Node.js and NPM in WSL

Often, you need to install Node and NPM to work with web development.

Bash install

curl -o- | bash

Zsh install

Add nvm to your plugins in ~/zshrc.

plugins=(git nvm)

Node installation

Now, use nvm to install Node.

nvm install 12.16.1

Setup Git

First, install the latest version of Git.

sudo apt install git

Add your credentials.

git config --global "<name here>"
git config --global "<email here>"


To install and setup Docker, refer to my other guide here.

Modify WSL configurations

If you are running Windows 10 18.03+ or newer, it might be good to make some changes. sudo nano /etc/wsl.conf to edit your configurations file.

root = /
options = "metadata"

This will allow you to work from /c instead of /mnt/c, and also fixes some of your permissions. You need to sign out of Windows to make this work.