Danny Moran

How to install WSL (Windows Subsystem for Linux)

Published April 22, 2023 by Danny Moran

Table of Contents
PAGE CONTENT

Introduction

Learn how to install and setup the Windows Subsystem for Linux (WSL) on Windows 11, and how to install and manage the WSL instances. In this example, I show you how to use the Windows Terminal to install the Windows Virtual Machine Platform and the Windows Subsystem for Linux features, as well as installing Linux distributions.

Video

Installing WSL

The easiest way to install WSL is to use the Windows Terminal which is built into the latest versions of Windows 11. To enable all of the features which are required by WSL, you can run the following command. Once the command has finished running, you will need to restart your Windows workstation.

wsl --install --no-distribution

Finding Available Linux Distributions

Once WSL has finished installing and the workstation has been rebooted, you can run the following command to find a list of all Linux Distributions that are available for install on WSL.

wsl --list --online

Installing a Linux Distribution

After generating the list of available distributions that can be installed on WSL, you can run the following command to automatically install the required distribution. In the below example, I am installing Ubuntu but you can replace ubuntu with the verion of Linux you want to install. Once the download and install has finished, you will need to enter a username for the WSL instance and then enter a password.

wsl --install ubuntu

Check Installed WSL Instances

You can easily check which WSL instances have been installed on the host workstaion by running the below command. This will return a list of all installed distributions, their running state, and if they are running on WSL1 or WSL2.

wsl -l -v

Shutdown All WSL Instances

When you are finished using a WSL instance, it should automatically shutdown when it’s not in use. If you don’t want to wait for them to automatically shutdown, you can run the below command to shutdown all instances at once.

wsl --shutdown

Shutdown A Single WSL Instance

You can shutdown specific WSL instances by running the below command. In the below example, I am shutting down Ubuntu but you can replace ubuntu with the verion of Linux you want to shutdown.

wsl -t ubuntu

Deleting WSL Instances

When you are finished using a WSL instance and it is no longer required, or you just want to delete it so you can create a new clean linux installation, you can run the following command. In the below example, I am deleting Ubuntu but you can replace ubuntu with the verion of Linux you want to delete.

wsl --unregister ubuntu