top of page
  • Writer's picturemaximrub

Setting Up A Windows 11 Development Environment with WSL 2 & WSLg

Updated: Feb 25, 2022

In this article we will go thorough a step-by-step guide to help you set up a WSLg development environment on Windows 11 using the Ubuntu distribution.

We will install Docker, IDEs such as Jetbrains Rider, Jetbrains GoLand, Visual Studio Code and more.

Installing WSL 2 with WSLg and the Ubuntu Linux distribution

You can now install everything you need to run Windows Subsystem for Linux 2 (WSL 2) by entering this command in an administrator PowerShell or Windows Command Prompt and then restarting your machine.

wsl --install

This command will enable the required optional components, download the latest Linux kernel, set WSL 2 as your default, and install a Linux distribution for you (Ubuntu by default).

Once the installation is done, a Ubuntu terminal will lunch and ask you to set a username and password.

WSL is now installed and ready for us to use.

We will start by making sure all packages are up do date, to do so, run the following commands

sudo apt update -y
sudo apt upgrade -y

Configuring Git

let's start by creating a directory for our source code

mkdir -p ~/source/repos

Now let's generate an SSH Public Key, run

ssh-keygen -o

and press 'Enter' on every step to use the defaults.

Now, if you run

cat ~/.ssh/

you will see your SSH Public Key.

Now let's configure our Identity in Git, by setting our user name and email address. This is important because every Git commit uses this information, and it’s immutably baked into the commits you start creating.

git config --global "John Doe"
git config --global

Installing a Browser

Some of our installation will require us to have a browser installed in Ubuntu.

We will install Firefox by running

curl | bash

Now, Close and reopen Ubuntu’s terminal.

You can start the browser by running


in the terminal.

Docker & Docker Compose Installation

Personally, I don't see any reason to install the heavy Docker Desktop for Windows, we can install Docker in WSL 2 and get a full Docker experience in Linux.

Furthermore, since Docker announced a new subscription for Docker Desktop for personal use, you need to acquire licenses for all installations of Docker Desktop for educational institutions, non-commercial open-source projects, small businesses and enterprises.

We will proceed by installing Docker & Docker Compose directly in Ubuntu, unless you must run Windows containers you won't miss anything Docker Desktop provides except for GUI. We can even expose containers to the Windows host, as any open port in WSL is accessible in Windows via localhost.

To simplify the installation, I created a script you can run by

curl | bash

If you have a look at the script in this link, you will see that we are adding the following section to .bashrc

echo '# Start Docker daemon automatically when logging in if not running.' >> ~/.bashrc
echo 'RUNNING=`ps aux | grep dockerd | grep -v grep`' >> ~/.bashrc
echo 'if [ -z "$RUNNING" ]; then' >> ~/.bashrc
echo '    sudo dockerd > /dev/null 2>&1 &' >> ~/.bashrc
echo '    disown' >> ~/.bashrc
echo 'fi' >> ~/.bashrc

and allowing to start dockerd without being prompted for a password

echo "${USER} ALL=(ALL) NOPASSWD: /usr/bin/dockerd" | sudo tee -a /etc/sudoers

to automatically run the docker daemon if it’s not running yet.

We are doing this as WSL 2 doesn’t run systemd, so we cannot use systemd to automatically start Docker as you typically would in a Linux system.

Now, Close and reopen Ubuntu’s terminal.

You can check the status of Docker and Docker Compose by running

docker run hello-world
docker-compose version


We are going to install the .NET SDK by running

curl | bash

you can now run

dotnet --list-sdks

to list the installed SDKs versions.


We are going to install the Go by running

curl | bash

Now, Close and reopen Ubuntu’s terminal.

Verify the installation by printing the Go version

go version


Now, we'll install some IDEs we will be using.

Visual Studio Code

First, we will install Visual Studio Code.

Visual Studio Code has a built-in integration with WSL 2 that includes debugging support in WSL 2 context, so we are actually are going to install it in Windows.

Install Visual Studio Code for Windows from this link.

Open Ubuntu’s terminal and cd to the path you want to open in VS Code.

Now run the following command

code .

Jetbrains IDEs

Now, we are going to install some Jetbrains IDEs by installing the Jetbrains Toolbox app.

curl | bash

Now, Close and reopen Ubuntu’s terminal.

Lunch the toolbox app by running


Jetbrains Shell scripts

We will configure the toolbox app to generate shell scripts for the installed IDEs.

Click on on the settings button

enable shell scripts generation and set


as the scripts location.

We have added this location to PATH during the toolbox app installation.

Finish by clicking the "Apply" button.

Install IDEs

Now, go back in the toolbox app and install the IDEs you need such as Rider, GoLand, etc...

You can always use the toolbox app to install and update your IDEs.

You can now list the names of the scripts using

ls ~/.local/share/JetBrains/bin

and lunch the IDEs

What’s next?

You now have a decent setup of a development environment on Windows with WSL 2 and WSLg.

You can now start developing and installing more tools you might need.

Recent Posts

See All

How to change the DNS settings for WSL 2

In this article we will go thorough a step-by-step guide to help you change the automatic DNS resolution in WSL 2. This is usually needed when you run WSL 2 behind a VPN. First, we need to turn off au


bottom of page