- Install subsystem for Linux 2 (WSL2) on Windows Server
- WSL support for Windows Server
- Installing WSL2
- Conclusion
- Руководство по установке Windows Server
- Установка WSL в Windows Server 2022
- Установка WSL в предыдущих версиях Windows Server
- Включение подсистемы Windows для Linux
- Скачивание дистрибутива Linux
- Извлечение и установка дистрибутива Linux
- Windows Server Installation Guide
- Install WSL on Windows Server 2022
- Install WSL on previous versions of Windows Server
- Enable the Windows Subsystem for Linux
- Download a Linux distribution
- Extract and install a Linux distribution
- How to install WSL in Windows Server 2022
- How to install WSL
- How to install the WSL Linux Distribution
Install subsystem for Linux 2 (WSL2) on Windows Server
While the second generation of the Linux subsystem has been on board with Windows 10 since version 20H1, Windows Server users have had to settle for WSL1 until now. After some back and forth, Microsoft has now decided to offer WSL2 for Windows Server 2022. However, Server 2019 will be left out.
Wolfgang Sommergut has over 20 years of experience in IT journalism. He has also worked as a system administrator and as a tech consultant. Today he runs the German publication WindowsPro.de.
WSL2 is based on a new architecture for which Microsoft provides its own Linux kernel. This runs on a lightweight virtual machine. You don’t have to create this utility VM yourself, but of course its hardware requirements must still be met. Therefore, you have to activate nested virtualization if you want to run WSL2 in a VM.
In addition, Linux programs can use the native interfaces of the Linux kernel. This allows more applications to run under WSL2 than before, including Docker containers.
Another benefit of the architecture change is that WSL2 can use a native EXT4 file system within the VHDX.
WSL support for Windows Server
To date, Windows Server 2004, which appeared in the now-abandoned semiannual channel, was the only version to benefit from WSL2. However, support for this server version has recently expired, so WSL2 is no longer available for any current version of the server OS.
After WSL2 was included in previews for Windows Server 2022, Microsoft decided at the end of 2020 that the final version would only be shipped with WSL1. After feedback from the community, the company changed its stance and announced WSL2 for Server 2022 and all subsequent LTSC versions. However, WSL2 will not be backported to Server 2019.
Installing WSL2
With the June 2022 cumulative update, Microsoft added the option of installing WSL2. Previously, the feature could be added via the optional update KB5014021.
Prior to the June update Microsoft made WSL2 available through KB5014021
For installation, you can also use the simplified procedure via wsl.exe on Server 2022. Before you start, you can get an overview of the available Linux distributions with the following command:
From the output, copy the name (not the friendly name) of the preferred distro for use in the next command. Subsequently, enter the following call to wsl.exe in a command line with administrative rights:
In our example, the distro is Ubuntu-20.04.
Installation of subsystem for Linux 2 using wsl.exe_
The setup routine will now install all WSL2 components and then require a reboot of the computer. After logging in again, the installation finishes with the configuration of the first Linux user and the user’s password.
After the reboot the setup configures the installed distribution
you can verify that WSL uses version 2 by default. WSL1 is still on board, and you can run several Linux distributions side by side, using either WSL1 or WSL2.
Installing WSL on Windows Server 2022 activates version 2 by default after the June update
Installing WSL on Windows Server 2022 activates version 2 by default after the June update
Currently, there is still a problem with Windows Terminal. It recognizes the installed distributions but exits when a session is opened; it shows the following error:
The system cannot find the file specified.
[process exited with code 4294967295 (0xffffffff)]
Windows Terminal currently generates an error when invoking the Linux shel
Windows Terminal currently generates an error when invoking the Linux shell
Conclusion
After changing course several times, Microsoft finally decided to also support WSL2 in LTSC versions of its server operating system. However, this does not apply to Windows Server 2019, whose users will be stuck with WSL1.
Microsoft also points out WSL2’s limited usage scenarios. It is not intended to run productive Linux workloads. For this purpose, the company recommends the use of virtual machines. However, the feature is very popular for developer or lab environments.
Руководство по установке Windows Server
Подсистема Windows для Linux (WSL) доступна для установки на Windows Server 2019 (версия 1709) и более поздних версий. В этом руководстве рассматриваются действия по включению WSL на компьютере.
Установка WSL в Windows Server 2022
Теперь Windows Server 2022 поддерживает простую установку WSL с помощью команды:
Теперь вы можете установить все необходимые компоненты для запуска WSL в Windows Server 2022. Для этого введите эту команду в PowerShell от имени администратора или в командной строке Windows и перезапустите компьютер.
Эта команда позволяет включить необходимые дополнительные компоненты, скачать последнюю версию ядра Linux, установить WSL 2 в качестве компонента по умолчанию и установить дистрибутив Linux (по умолчанию Ubuntu).
Из стандартной документации по WSL вы узнаете, как выполнять следующие задачи:
Установка WSL в предыдущих версиях Windows Server
Чтобы установить WSL в Windows Server 2019 (версия 1709+), выполните действия, описанные ниже.
Включение подсистемы Windows для Linux
Перед запуском дистрибутивов Linux в Windows необходимо включить дополнительный компонент «Подсистема Windows для Linux» и перезагрузить компьютер.
Запустите PowerShell от имени администратора и выполните следующую команду:
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
Скачивание дистрибутива Linux
Инструкции и ссылки для скачивания нужного дистрибутива Linux см. в разделе Скачивание дистрибутивов в статье по выполнению установки вручную.
Извлечение и установка дистрибутива Linux
После загрузки дистрибутива Linux для извлечения его содержимого и установки вручную выполните следующие действия.
- Извлеките содержимое пакета .appx , с помощью PowerShell:
Rename-Item .\Ubuntu.appx .\Ubuntu.zip Expand-Archive .\Ubuntu.zip .\Ubuntu
Add-AppxPackage .\app_name.appx
Сбой установки с ошибкой 0x8007007e. При возникновении этой ошибки система не поддерживает WSL. Убедитесь, что вы используете сборку Windows 16215 или более позднюю версию. Проверьте используемую сборку. Также убедитесь, что WSL включен и ваш компьютер перезагружен после включения этой функции.
3. Добавьте путь к дистрибутиву Linux в переменную PATH в Windows (в этом примере C:\Users\Administrator\Ubuntu ) с помощью PowerShell:
$userenv = [System.Environment]::GetEnvironmentVariable("Path", "User") [System.Environment]::SetEnvironmentVariable("PATH", $userenv + ";C:\Users\Administrator\Ubuntu", "User")
Теперь вы можете запустить дистрибутив из любого пути, введя .exe . Например: ubuntu.exe .
Windows Server Installation Guide
The Windows Subsystem for Linux (WSL) is available for installation on Windows Server 2019 (version 1709) and later. This guide will walk through the steps of enabling WSL on your machine.
Install WSL on Windows Server 2022
Windows Server 2022 now supports a simple WSL installation using the command:
You can now install everything you need to run WSL on Windows Server 2022 by entering this command in an administrator PowerShell or Windows Command Prompt and then restarting your machine.
This command will enable the required optional components, download the latest Linux kernel, set WSL 2 as your default, and install a Linux distribution for you (Ubuntu by default).
See the standard WSL docs for more information on how to:
Install WSL on previous versions of Windows Server
To install WSL on Windows Server 2019 (version 1709+), you can follow the manual install steps below.
Enable the Windows Subsystem for Linux
Before you can run Linux distributions on Windows, you must enable the «Windows Subsystem for Linux» optional feature and reboot.
Open PowerShell as Administrator and run:
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
Download a Linux distribution
See the Downloading distributions section of the manual installation page for instructions and links to download your preferred Linux distribution.
Extract and install a Linux distribution
Now that you’ve downloaded a Linux distribution, in order to extract its contents and manually install, follow these steps:
- Extract the .appx package’s contents, using PowerShell:
Rename-Item .\Ubuntu.appx .\Ubuntu.zip Expand-Archive .\Ubuntu.zip .\Ubuntu
Add-AppxPackage .\app_name.appx
Installation failed with error 0x8007007e: If you receive this error, then your system doesn’t support WSL. Ensure that you’re running Windows build 16215 or later. Check your build. Also check to confirm that WSL is enabled and your computer was restarted after the feature was enabled.
3.Add your Linux distribution path to the Windows environment PATH ( C:\Users\Administrator\Ubuntu in this example), using PowerShell:
$userenv = [System.Environment]::GetEnvironmentVariable("Path", "User") [System.Environment]::SetEnvironmentVariable("PATH", $userenv + ";C:\Users\Administrator\Ubuntu", "User")
You can now launch your distribution from any path by typing .exe . For example: ubuntu.exe .
How to install WSL in Windows Server 2022
Microsoft announces that the Windows Server 2022 will support WSL2 after installing the Windows Update of June. This is excellent news for the DevOps and IT professionals.
However t oday I will describe how can install WSL1 to the Windows Server 2022.
How to install WSL
The installation of the WSL is very easy and you can do it with a simple PowerShell command.
Open the Powershell as administrator and run the following command
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
When the installation is finished will be requested to restart the Server.
How to install the WSL Linux Distribution
After restarting the Server open the Powershell as Administrator and run the following command to get a list of Linux Distributions that you can use in WSL.
Select the Linux Distribution that you want and type the following command. I selected the Ubuntu-20.04.
wsl —install -d Ubuntu-20.04
Wait a few minutes for the installation to complete. Type a username/password that you want to use.
That’s it . . Now you have the Ubuntu inside the Windows Server 2022.
I invite you to follow me on Twitter or Facebook. If you have any questions, send email to me at info@askme4tech.com