주요 콘텐츠

Install Ubuntu Distribution for Windows Subsystem for Linux (WSL) and Setup

Note

This step is required only if you have not setup the username and password for your WSL2 installation after you have installed it for the first time.

Configure Ubuntu 22.04 in WSL2

After you install WSL2 by following the instructions in Install Windows Subsystem for Linux (WSL2) documentation, configure Ubuntu 22.04 by creating a username and password. Perform these steps

To determine which scenario applies to your system, check for Ubuntu 22.04 distribution in WSL. Open a Windows Command Prompt and execute the following command:

  1. Open the Windows Command Prompt as a regular user (not as an administrator).

    Press the Windows Start key, type cmd, and press Enter.

  2. List available distributions.

    • Run this command in the command prompt.

      wsl --list --online
  3. Locate Ubuntu 22.04

    • Look for Ubuntu-22.04 in the list. This is the common name for Ubuntu 22.04.

    • If the name differs, use the exact name shown in your list.

  4. Install Ubuntu 22.04

    • Run this command.

      wsl --install -d Ubuntu-22.04

      If the distribution name is different, replace Ubuntu-22.04 with the correct name from your list:

      wsl --install -d <DistributionName>
  5. Set up Ubuntu.

    • After rebooting, installed Ubuntu distribution will prompt you to configure a new username and password for your Ubuntu environment.

Launch WSL2 shell

Launch the WSL2 shell using these steps:

Open the Windows Command Prompt and type:

wsl -d Ubuntu-22.04

If the distribution name is different, replace Ubuntu-22.04 with the correct name from your list:

wsl --install -d <DistributionName>