Saturday, January 22, 2022

WSL 2.0: Installing Windows Subsystem for Linux (WSL) -- the WSL meant for Docker

Overview

Why install WSL 2.0? Writing scalable backends (web services) using Microsoft's stack is a matter using Docker (or another container technology), .NET Core/.NET 5/.NET 6, and a Linux distribution. The most realistic development platform for a Windows engineer is Windows Subsystem for Linux 2.0 (WSL). To quote Wikipedia's write up on WSL 2.0 (WSL 2), this version of WSL is optimized for Docker/virtualization:

Prerequisites

To quote Microsoft's documentation, "Install WSL", the operating system prerequisites for installing WSL 2.0 are as follows:


The user installing WSL 2.0 should have local administrator rights and PowerShell should be enabled to be executed (see cmdlet Set-ExecutionPolicy). As of this time, PowerShell 7.2 is the most recent version.

Installation Steps

1. Run the PowerShell console window with administrative permissions.
2. From the PowerShell console, invoke wsl --list --online to list the candidate Linux distributions that can be installed.


3. From the PowerShell console, invoke wsl --install and specify Linux distribution to install using -d (e.g. wsl --install -d Ubuntu-20.04 to install Ubuntu 20.04):


4. When invoked wsl --install will launch a new console corresponding to the Linx distribution being installed (see below):


5. Enter the username, and, when prompted, enter and confirm the password. Once these have been specified the screen will appear as follows:


With that WSL 2.0 is installed on Windows.

No comments :

Post a Comment