Install Windows Subsystem for Linux on your EC2 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 Windows Subsystem for Linux on your EC2 Windows instance

There are two versions of Windows Subsystem for Linux (WSL) that you can install depending on your instance type and instance operating system: WSL 1 and WSL 2. For .metal instance types, you can install either WSL 1 or WSL 2. For all other instance types, the following requirements apply:

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

  • For instances that run Windows Server, the operating system version must be one of the following to install WSL:

    • Windows Server 2019

    • Windows Server 2022

    • Windows Server 2025

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

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.

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 --no-launch
  2. Restart your EC2 instance.

    shutdown -r -t 20
  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
  4. Install the default distribution.

    wsl --install
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.