Install and configure WSL2 with Windows Terminal

Install and configure WSL2 with Windows Terminal

config tools for coding



👣 #wsl #terminal #zsh

Switching between Windows and macOS for development, the Windows Subsystem for Linux (WSL) is a good choice to have a similar experience on both sides. As WSL evolves into version 2, and I’m just re-installed Windows 10 on my PC, I’m going to install and config WSL2 on this “fresh” system.

Check requirements for running WSL2

To install WSL2, you must be running Windows 10+:

  • For x64 systems: Version 1903 or higher, with BUild 18362 or higher.
  • For ARM64 systems: Version 2004 or higher, with Build 19041 or higher.
  • Builds lower than 18362 do not support WSL2.

To check your version and build number, select WIN + R, type winver, and select OK.

Install Windows Terminal

Just search and install the Windows Terminal in Microsoft Store. Though, you can still use PowerShell.

Install WSL2

Enable the Windows Subsystem for Linux

You must first enable the “Windows Subsystem for Linux” optional feature before installing any Linux distributions on Windows. Open Windows Terminal as Administrator, it will start PowerShell by default:

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

Enable the Virtual Machine feature

Before installing WSL2, you must enable the Virtual Machine Platform option feature. Your machine will require virtualization capabilities to use this feature.

Also in Windows Terminal with Administrator privilege, run:

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

After the above steps, you must restart your system to process the following installations…

Download the Linux kernel update package

  1. Download the latest package:

    WSL2 Linux kernel update package for x64 machines

    If you’re using an ARM64 machine, please download the ARM64 package instead. If you’re not sure what kind of machine you have, open Command Prompt or PowerShell and enter: systeminfo | find "System Type".

  2. Run the update package downloaded in the previous step. Double-click to run - you will be prompted for elevated permissions, select ‘yes’ to approve this installation.

  3. Restart the system.

Set WSL2 as your default version

After restarting the system, let’s set WSL2 as the default version when installing a new Linux distribution. Still in Windows Terminal with Administrator privilege:

wsl --set-default-version 2

Install your Linux distribution of choice

Now, let’s open Microsoft Store, search for your favourite Linux distribution, and install it. I’ve installed Ubuntu for convenience.

Or, you can install Ubuntu or other Linux distributions with wsl commands:

wsl --install -d Ubuntu

After it’s been installed in Microsoft Store, launch it in Start menu, a console window will open and you’ll be asked to wait for a minute or two for files to de-compress and be stored on your PC.

You will then need to create a user account and password for your new Linux distribution.

In my case, after Ubuntu was set up, update and install some building tools:

sudo apt update
sudo apt install build-essential

Configure Windows Terminal

  1. Open Windows Terminal and open the settings with Ctrl + , shortcut. You should see the file settings.json.

  2. Windows Terminal will start PowerShell by default, now let’s switch it to WSL2. You can achieve this by copying the guid value of your Linux distribution into defaultProfile in settings.json.

    setting.json file

  3. After that, you can choose a better colour scheme other than the default one. There are some pre-defined ones that you can select from Microsoft’s document. Or, you can define your custom colour scheme in settings.json, see more here. I still prefer Dracula colour scheme that I used in macOS

    In the settings.json settings file, find the schemes section and paste the following content:

    "schemes": [
            "name": "Dracula",
            "cursorColor": "#F8F8F2",
            "selectionBackground": "#44475A",
            "background": "#282A36",
            "foreground": "#F8F8F2",
            "black": "#21222C",
            "blue": "#BD93F9",
            "cyan": "#8BE9FD",
            "green": "#50FA7B",
            "purple": "#FF79C6",
            "red": "#FF5555",
            "white": "#F8F8F2",
            "yellow": "#F1FA8C",
            "brightBlack": "#6272A4",
            "brightBlue": "#D6ACFF",
            "brightCyan": "#A4FFFF",
            "brightGreen": "#69FF94",
            "brightPurple": "#FF92DF",
            "brightRed": "#FF6E6E",
            "brightWhite": "#FFFFFF",
            "brightYellow": "#FFFFA5"

    Next, find the profiles section and add a colorScheme value to the default profile:

    "profiles": {
        "defaults": {
            "colorScheme" : "Dracula"
  4. To have a correctly working theme, you needed to download and install some needed fonts. For example, you can install powerline fonts using the PowerShell command prompt:

    # clone
    git clone --depth=1
    # install
    cd fonts
    # clean-up a bit
    cd ..
    rm -rf fonts

    For me, I’d prefer Operator Mono fonts. Here’s a patched version, download and install the fonts manually, then configure the fontFace in settings.json:

    "profiles": {
        "defaults": {
            "colorScheme" : "Dracula",
          	"fontFace" : "OperatorMonoSSmLig Nerd Font"

Install oh-my-zsh

Run the following commands in WSL2:

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

You may need to restart Windows Terminal for a new session.

Install useful plugins and configure ZSH

git clone ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
git clone --depth=1 ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/themes/powerlevel10k

Now, let’s modify ~/.zshrc with the following content:

# Use Powerlevel10k theme

# Use plugins
plugins=(git zsh-autosuggestions zsh-syntax-highlighting)

Save the .zshrc file and source ~/.zshrc, the Powerlevel10k wizard should show up, which will guide you through the setup.

Eventually, the Windows Terminal will look like this depending on your configures in p10k:

WSL2 screenshot

If not satisfied, you can re-run p10k configure to overwrite the settings.

More about oh-my-zsh plugins and Powerlevel10k configuration.


Yeah, we’re done 🎉. With this setup, we can have a full Linux-like development inside WSL2 and a nice-looking Terminal with a similar experience on macOS.

Ads by Google


Frank Lin

Hey, there! This is Frank Lin (@flinhong), one of the 1.41 billion . This 'inDev. Journal' site holds the exploration of my quirky thoughts and random adventures through life. Hope you enjoy reading and perusing my posts.


Setup an IKEv2 server with strongSwan



Setup an IKEv2 server with strongSwan

IKEv2, or Internet Key Exchange v2, is a protocol that allows for direct IPSec tunnelling between networks. It is developed by Microsoft and Cisco (primarily) for mobile users, and introduced as an updated version of IKEv1 in 2005. The IKEv2 MOBIKE (Mobility and Multihoming) protocol allows the client to main secure connection despite network switches, such as when leaving a WiFi area for a mobile data area. IKEv2 works on most platforms, and natively supported on some platforms (OS X 10.11+, iOS 9.1+, and Windows 10) with no additional applications necessary.

Hands on IBM Cloud Functions with CLI



Hands on IBM Cloud Functions with CLI

IBM Cloud CLI allows complete management of the Cloud Functions system. You can use the Cloud Functions CLI plugin-in to manage your code snippets in actions, create triggers, and rules to enable your actions to respond to events, and bundle actions into packages.