The Windows Subsystem for Linux (WSL) is a feature of Windows that allows you to run native Linux command-line tools directly on Windows. It provides a Linux-compatible kernel interface developed by Microsoft, which allows you to use Linux applications on Windows.
This means that you can use Linux tools and utilities at the same level of performance as if they were running on a native Linux system, which is way better than using a virtual machine.
learn more here. 📖
-
Open PowerShell as Administrator and run:
- Default distribution is Ubuntu if you want another one use :
wsl --install -d <Distribution name>
- To see all available distribution use :
wsl --list --online
wsl --install
ℹ️ Later you can update wsl in Microsoft store or by using
wsl --update
in powershell/cmd. - Default distribution is Ubuntu if you want another one use :
-
Restart your computer.
-
Search the distribution you have chosen in the Start menu and run it.
-
When installed, you will be prompted to create a new user account and password. This will be the user account you will use to log in to your Linux distribution.
-
Open Microsoft Store and install Windows Terminal.
This terminal is a modern, fast, efficient, powerful, and productive terminal application for users of command-line tools and shells like Command Prompt, PowerShell, and WSL.
-
Open Windows Terminal and click on the settings icon in the top right corner.
-
In the settings, click on the dropdown menu under "Default profile" and select your desired Linux distribution.
-
Don't forget to set Windows Terminal as your default terminal and you're good to go!
-
# Zsh is a shell designed for interactive use, you can have plugins, themes, etc. sudo apt update && sudo apt upgrade -y sudo apt install zsh curl -y
-
Install Oh My Zsh.
# Oh My Zsh is an open source, community-driven framework for managing your Zsh configuration. sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
-
Install Zsh plugins, you can find more plugins here.
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
Then add the following line to your ~/.zshrc file :
plugins=(git sudo docker npm vscode zsh-autosuggestions zsh-syntax-highlighting)
-
(optional) Install Powerlevel10k, if you want to use another theme, you can find more themes here.
⚠️ This theme require specific fonts, you can check here how to install them.git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/powerlevel10k echo 'source ~/powerlevel10k/powerlevel10k.zsh-theme' >>~/.zshrc
-
Set
ZSH_THEME="powerlevel10k/powerlevel10k"
in ~/.zshrc. -
Restart Zsh with
exec zsh
-
Type
p10k configure
if the configuration wizard doesn't start automatically.
-
-
Nano configuration.
Configuring Nano is optional, you can use another editor like Vim, Emacs, if you prefer.
nano ~/.nanorc # Add this in the file : set atblanks set mouse set cutfromcursor set softwrap set tabsize 4 set tabstospaces include "/usr/share/nano/*.nanorc" set speller "aspell -x -c" set constantshow set linenumbers set casesensitive set historylog set positionlog set smarthome set zap set autoindent bind ^C copy main # CTRC+C - Copy bind ^V paste all # CTRL+V - Past bind ^S savefile main # CTRL+S - Save
-
Install build essential. (gcc, g++, make, must have for development)
sudo apt install build-essential -y
-
Install Git.
sudo apt install git -y git config --global user.email 'your email' git config --global user.name 'your name'
-
Install Docker Desktop
Docker Desktop uses the dynamic memory allocation feature in WSL 2 to optimize resource consumption.
For more information, refer to the Working with Docker & WSL documentation. -
Tool versioning.
Managing version of tools is usefull for development, my favorite tool for this is proto.
If you only need to manage Node.js version, you can use fnm.
# Requirements sudo apt install unzip gzip xz-utils -y curl -fsSL https://moonrepo.dev/install/proto.sh | bash proto setup # Install what you need : proto install node lts proto install python
You can find more information about proto here.
-
Update, upgrade and clean package list.
sudo apt update && sudo apt upgrade -y && sudo apt autoremove
Note
There are numerous useful tools you can install to enhance your experience on Linux and WSL link.
Microsoft has also created a guide to help you maximize the benefits of WSL if you use VS Code link.
When working with WSL, always clone or create your projects inside the Linux file system,
otherwise performance may significantly decrease, and certain features might not work properly (e.g: hot reloading).
For more information, refer to the Docker best practices documentation.
You are now ready to start developing on WSL! 🎉
Made with ❤️ by @Jayllyz