Installing Linux on Windows 10 and Windows 11 with one command "wsl.exe --install"

Installing Linux on Windows 10 and Windows 11

Let's look at the instructions for installing Linux on Windows 10 and Windows 11 using WSL 2, as well as list the key commands for working with the Windows Subsystem for Linux (WSL).

Windows 10 and Windows 11 administrators who want to install Windows Subsystem for Linux (WSL) can do so by running a single command on Windows 10 versions 2004 and later, including Windows 11 Insider builds .

Microsoft introduced this improvement in Windows Insider preview builds back in October 2020 and is now available in the latest updates for Windows 10 versions 2004, 20H2, and 21H1.

The improvement is included in KB5004296, which is an optional update for the listed versions of Windows 10. Since the updates are cumulative, new features will be introduced in August 2021 on all devices using the standard update method - Windows Update.

Optional updates are installed only if operating system administrators purposefully search for an update or download it from the Microsoft Update Catalog website.

Microsoft does not specifically mention the WSL enhancement in the release notes. However, a Microsoft developer blog post written by Craig Loewen confirms the inclusion of a new install option for WSL in Windows 10 version 2004 and higher.

How to install WSL subsystem with one command in Windows 10 or Windows 11
All you need to do is open a command prompt as Administrator and run a command wsl.exe --install that initializes the process of installing WSL on the device. By default, the operating system will be installed Ubuntu, since this Linux distribution is offered as the default distribution if the administrator does not specify a specific distribution.

The main advantage of the new method is that the installation is much faster. Previously, you had to separately install all the necessary components on the device, but now it is enough to use one command.

List of commands for working with the WSL subsystem
Open the Start menu, find and run Command Prompt (cmd.exe) as Administrator.{alertWarning}

  • wsl.exe --install - Installs the WSL subsystem and Ubuntu distribution on the device.
  • wsl --list --online - Lists all available Linux distributions that you can install using the wsl command. Currently, it is:
*Ubuntu - Ubuntu
*Debian - Debian GNU / Linux
*kali-linux - Kali Linux Rolling
*openSUSE-42 - openSUSE Leap 42
*SLES-12 - SUSE Linux Enterprise Server v12
*Ubuntu-16.04 - Ubuntu 16.04 LTS
*Ubuntu-18.04 - Ubuntu 18.04 LTS
*Ubuntu-20.04 - Ubuntu 20.04 LTS{codeBox}

  • wsl --install -d DistroName - installs the selected distribution. Replace DistroName with the name of your distribution. Also, the command can be used to install additional distributions.
  • wsl --update - command to update the WSL Linux kernel.
  • wsl --update rollback - command to rollback to the previous version of WSL core
  • wsl --status - Displays general information about the installation status of the WSL subsystem
  • wsl --help - Displays a list of command options and arguments for the WSL subset. 

The install command will install the WSL 2 subsystem version to the device. You can verify this by running wsl with the status parameter after successful installation. If you see version 2, it means that the second version of Windows Subsystem for Linux is installed.

The new commands make it much easier to install WSL on Windows 10 and Windows 11 devices. The only missing command is the uninstall command, so you cannot use a command-line tool to remove a WSL installation from a device. Microsoft hasn't said if the tool will also be included in Windows 11, but adding it seems logical and likely.

Post a Comment

Previous Post Next Post