Chat Zalo Chat Messenger Phone Number Đăng nhập
Install Linux on Windows with WSL - Microsoft Learn

Install Linux on Windows with WSL – Microsoft Learn

For simplicity, we generally recommend using wsl -install to install the Windows subsystem for Linux, but if you’re running an older build of Windows, it may not be supported. We have included the manual installation steps below. If you encounter a problem during the installation process, see the installation section of the troubleshooting guide.

Step 1 – Enable

Windows Subsystem for Linux

You must first enable the optional “Windows Subsystem for Linux” feature before installing any Linux distribution on Windows

. Open PowerShell as administrator

(Start menu > PowerShell > right-click > Run as administrator) and type this command

: dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart We recommend now moving to step #2, upgrading to WSL

2, but if you just want to install WSL 1, you can now restart your machine and proceed to Step 6: Install the Linux distribution of your choice. To upgrade to WSL 2, wait to restart your computer and continue to the next step.

Step 2:

Check the requirements to run

WSL 2

To upgrade to WSL 2, you must be running Windows 10…

For x64-based systems: version 1903 or later, build

  • 18362 or later. For ARM64 systems: Version 2004 or later, with Build 19041 or later. or Windows 11. To
  • check the version and build number, select Windows logo key + R, type winver, select OK

  • .

Update to the latest version of Windows in the Settings menu.

Step 3: Enable

the Virtual Machine

Feature Before you install WSL 2, you must enable the optional Virtual Machine Platform feature. Your machine will need virtualization capabilities to use this feature.

Open PowerShell as administrator and run

: dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

Restart the computer to complete the WSL installation and upgrade to WSL 2.

Step 4: Download the Linux kernel update package Download the latest package: WSL2 Linux

    • Kernel Update Package for
  1. x64 Machines Run the update package downloaded in the previous step. (Double-click to run: you will be prompted for elevated permissions, select ‘yes’ to approve this installation.)

After the installation is complete, proceed to the next step: set WSL 2 as your default version when installing new Linux distributions. (Skip this step if you want your new Linux installations to be set to WSL 1.)

Step 5: Set WSL 2 as your default version Open PowerShell and

run this command to set WSL 2 as the default version when installing a new

Linux distribution: wsl -set-default-version

2 Step

6 – Install

the Linux distribution of your choice Open Microsoft Store

  1. and select your favorite Linux distribution.

    The following links will open the Microsoft Store page for each distribution:

    Ubuntu 18.04 LTS Ubuntu 20.04 LTS

    • Ubuntu 22.04 LTS
    • openSUSE Leap 15.1
    • SUSE Linux Enterprise Server

    • 12
    • SP5

    • SUSE Linux Enterprise Server 15 SP1
    • Kali
    • Linux

    • Debian GNU/Linux
    • Fedora Remix for
    • WSL Pengwin

    • Pengwin Enterprise
    • Alpine WSL
    • Raft(Free Trial)
  2. From the distribution page, select “Get”.

The first time you launch a newly installed Linux distribution, a console window will open and you will be asked to wait a minute or two for the files to be unzipped and stored on your PC. All future releases should take less than a second.

Next, you’ll need to create a user account and password for your new Linux distribution.

Congratulations! You have successfully installed and configured a Linux distribution that is fully integrated with your Windows operating system!

Troubleshoot

installation

problems If you have a problem during the installation process, see the installation section of the troubleshooting guide

.

Downloading

distributions

There are some scenarios where you may not be able (or want to) install WSL Linux distributions through the Microsoft Store. You may be running a Windows Server Desktop OS or Long Term Servicing (LTSC) SKU that Microsoft Store does not support, or your corporate network policies or administrators may not allow the use of Microsoft Store in your environment. In these cases, while WSL is available, you may need to download Linux distributions directly.

If the Microsoft Store app isn’t available, you can manually download and install Linux distributions using these links:

Ubuntu Ubuntu 22.04 LTS Ubuntu 20.04 Ubuntu 20.04 ARM Ubuntu 18.04 Ubuntu

  • 18.04 ARM Ubuntu 16.04
  • Debian GNU/
  • Linux

  • Kali
  • Linux SUSE Linux Enterprise Server 12 SUSE Linux Enterprise Server

  • 15

  • SP2 SUSE Linux Enterprise Server
  • 15

  • SP3
  • openSUSE Tumbleweed openSUSE Leap 15.3

  • openSUSE
  • Leap 15.2
  • Oracle Linux

  • 8.5 Oracle Linux
  • 7.9
  • Fedora Remix for WSL

This will cause the <distro>.appx packages to be downloaded to a folder of your choice.

If you prefer, you can also download your preferred distributions via the command line, you can use PowerShell with the Invoke-WebRequest cmdlet. For example, to download Ubuntu 20.04:

Invoke-WebRequest -Uri https://aka.ms/wslubuntu2004 -OutFile Ubuntu.appx -UseBasicParsing

You also have the option to use the curl command-line utility to download. To download Ubuntu 20.04 with

curl: curl.exe -L -o ubuntu-2004.appx https://aka.ms/wslubuntu2004 In this example, curl.exe runs (not just curl) to ensure that, in PowerShell, the actual curl

executable is invoked, not the PowerShell curl alias for Invoke-WebRequest.

Once the distribution is downloaded, navigate to the folder containing the download and run the following command in that directory, where app-name is the name of the Linux distribution .appx file.

Add-AppxPackage .app_name.appx

Once the Appx package has finished downloading, you can start running the new distribution by double-clicking the appx file. (The wsl -l command will not show that the distribution is installed until this step is completed.)

If you are using Windows Server

or are having problems running the above command, you can find alternative installation instructions on the Windows Server documentation page to install the .appx file by changing it to a zip file.

After the distribution

is installed, follow the instructions to create a user account and password for the new Linux distribution.

Install

Windows Terminal (optional)

Using Windows Terminal allows you to open multiple tabs or window panes to quickly display and switch between various Linux distributions or other command lines (PowerShell, command prompt, Azure CLI, etc.). You can fully customize your terminal with unique color schemes, font styles, sizes, background images, and custom keyboard shortcuts. Learn more.

Install Windows Terminal.

Contact US