Microsoft says the Windows Subsystem for Linux (WSL) can now be installed on Windows 10, version 2004 or later using a single terminal command.
"In the latest Windows Insider Preview builds, you can install everything you need to run WSL just by running wsl.exe --install," Windows Developer Platform Program Manager Craig Loewen said.
"We’re excited to announce that this functionality is now officially backported to Windows 10 version 2004 and higher, which will make installing WSL on those builds much easier!"
To get access to this new feature, you have to update your computer to Windows 10 2004 or later via Windows Update or install the KB5004296 preview cumulative update, which also comes with fixes for fixes Windows 10 gaming issues.
How to install and use WSL
While previously you had to jump through several hoops such as installing multiple packages and toggling on several OS settings, now you only have to open a Command Prompt window as administrator and run the wsl.exe --install
command.
This automatically enables WSL and installs Ubuntu as the default distro and the latest WSL Linux kernel version on the device.
After the installation process is completed and the computer is rebooted, the newly deployed Ubuntu distribution will automatically start logging in.
Once WSL is installed, you can use wsl --update
to update the Linux kernel and wsl --update rollback
to switch to a previous kernel version.
You can also use wsl --status
to get an overview of your WSL configuration, including the default distro type, default distro, and the currently installed Linux kernel version.
A short WSL history
WSL was released in 2018 and it is designed as a compatibility layer that makes it possible for Windows 10 users to run Linux binaries in ELF format natively on their computers, in a PowerShell or Windows 10 command prompt.
Since the initial release, Microsoft has also launched WSL 2, which increases file system performance, supports full system call compatibility, and uses virtualization tech to run a full Linux kernel inside a lightweight virtual machine (VM).
Even though users have been asking Microsoft to also add support for the Wayland protocol in WSL to allow GUI Linux apps to work on Windows since at least 2016, the company only announced that it would introduce Linux GUI support last year at BUILD 2020.
The new feature, dubbed WSLg (short for Windows Subsystem for Linux GUI), was released in April and began rolling out to all Insiders in May with the rollout of Windows 10 Insider Preview Build 21364 to the Dev Channel.
As previously described, WSLg allows you to use Linux GUI applications in Windows as you would use them on a Linux desktop.
Microsoft provides step-by-step guidance on how to install and launch Linux GUI apps on your PC. Once installed, these Linux apps can be launched from the Start menu or a Command Prompt window.
Comments
gazzooks - 2 years ago
I am running Windows 10 21H1 and when I try to run wsl.exe --install as administrator from command line, I get a response back saying there is no "--install" Commandline.
The following is my result:-
Microsoft Windows [Version 10.0.19043.1110]
(c) Microsoft Corporation. All rights reserved.
C:\WINDOWS\system32>wsl.exe --install
Invalid command line option: --install
Copyright (c) Microsoft Corporation. All rights reserved.
Usage: wsl.exe [Argument] [Options...] [CommandLine]
Arguments for running Linux binaries:
If no command line is provided, wsl.exe launches the default shell.
--exec, -e <CommandLine>
Execute the specified command without using the default Linux shell.
--
Pass the remaining command line as is.
Options:
--distribution, -d <Distro>
Run the specified distribution.
--user, -u <UserName>
Run as the specified user.
Arguments for managing Windows Subsystem for Linux:
--export <Distro> <FileName>
Exports the distribution to a tar file.
The filename can be - for standard output.
--import <Distro> <InstallLocation> <FileName> [Options]
Imports the specified tar file as a new distribution.
The filename can be - for standard input.
Options:
--version <Version>
Specifies the version to use for the new distribution.
--list, -l [Options]
Lists distributions.
Options:
--all
List all distributions, including distributions that are currently
being installed or uninstalled.
--running
List only distributions that are currently running.
--quiet, -q
Only show distribution names.
--verbose, -v
Show detailed information about all distributions.
--set-default, -s <Distro>
Sets the distribution as the default.
--set-default-version <Version>
Changes the default install version for new distributions.
--set-version <Distro> <Version>
Changes the version of the specified distribution.
--shutdown
Immediately terminates all running distributions and the WSL 2 lightweight utility virtual machine.
--terminate, -t <Distro>
Terminates the specified distribution.
--unregister <Distro>
Unregisters the distribution.
--help
Display usage information.
C:\WINDOWS\system32>wsl.exe /?
Windows Subsystem for Linux has no installed distributions.
Distributions can be installed by visiting the Microsoft Store:
https://aka.ms/wslstore
C:\WINDOWS\system32>
serghei - 2 years ago
Try installing the KB5004296 preview cumulative update.
gazzooks - 2 years ago
I installed KB5004296 but it still did not work with wsl.exe --install. I had to use command wsl.exe --install -d ubuntu.