Install WSL on your Windows instance - Amazon Elastic Compute Cloud
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Install WSL on your Windows instance

Windows Subsystem for Linux (WSL) is a free download that you can install on your Windows instance. By installing WSL, you can run native Linux command line tools directly on your Windows instance and use the Linux tools for scripting, alongside your traditional Windows desktop. You can easily swap between Linux and Windows on a single Windows instance, which you might find useful in a development environment.

For more information about WSL, see the Windows Subsystem for Linux Documentation on the Microsoft Build website.

Limitations

  • WSL is available in two versions: WSL 1 and WSL 2.

    • For .metal EC2 instances, you can install either WSL 1 or WSL 2.

    • For virtualized EC2 instances, you must install WSL 1.

  • For Windows Server operating systems, WSL can only be installed on instances running the following:

    • Windows Server 2019

    • Windows Server 2022

Install WSL

The following instructions install WSL on an EC2 instance running Windows Server 2022. For the instructions to install WSL on an EC2 instance running Windows Server 2019, see Install WSL on previous versions of Windows Server on the Microsoft website. After you've followed those instructions, you can use step 3 in the instructions below to configure WSL to use WSL 1.

To install WSL 1
  1. To install WSL, run the following standard installation command on your EC2 instance, but make sure to enable WSL 1 by including --enable-wsl1. By default, WSL 2 is installed. If your instance was launched using a virtualized instance type, you must complete step 3 in this procedure to set the version to WSL 1.

    wsl --install --enable-wsl1
  2. Restart your EC2 instance.

  3. To configure WSL to use WSL 1, run the following command on your instance. For more information about setting the WSL version, see Manual installation steps for older versions of WSL on the Microsoft Build website.

    wsl --set-default-version 1
To install WSL 2
  • To install WSL, run the following standard installation command on your EC2 instance. By default, WSL 2 is installed. If you are installing WSL on a .metal instance, then this is the only step to perform.

    wsl --install

    For more information, see Install Linux on Windows with WSL on the Microsoft Build website.