Одним из новшеств Windows Server 2016 версии RedStone 3 (1709) является встроенная поддержка запуска нативных бинарных файлов Linux ELF64. Данный функционал реализуется за счет отдельного компонента Windows Subsystem for Linux (WSL), который обеспечивает нужный слой совместимости. В этой обзорной статье мы покажем, как включить подсистему Windows для Linux в Windows Server 2016 и использовать ее для запуска Linux приложений.
Возможность запуска Linux приложений в Windows ранее была представлена в Windows 10. Эта функция носила название Bash on Windows. Начиная с Windows 10 Fall Creators Update это название более не используется и официально эта подсистема теперь называется WSL — Windows Subsystem for Linux. Кроме того, для ее использования более не нужно переключать ОС в режим разработчика (Developer Mode). WSL доступна как Windows Server, так и в виртуальных машинах Microsoft Azure
Предполагаем, что вы уже скачали и установили релиз Windows Server >= 1709. Это может быть сервер с полноценным GUI или в Core режиме.
Проверить текущую версию ОС можно так:
systeminfo | Select-String "^OS Name","^OS Version"
Чтобы проверить, что в вашей версии Windows Server имеется функционал WSL, выполните следующую команду:
Get-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
Чтобы включить поддержку подсистемы Linuх, выполните команду:
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
После чего сервер нужно перезагрузить.
Далее необходимо скачть архив с адаптированным дистрибутивом Linux. На данный момент Microsoft предлагает поддержку следующих дистрибутивов:
- Ubuntu – https://aka.ms/wsl-ubuntu-1604
- OpenSUSE – https://aka.ms/wsl-opensuse-42
- SLES – https://aka.ms/wsl-sles-12 — корпоративный вариант SUSE
В ближайшем будущем планируется добавить дистрибутивы CentOS и Fedora.
К примеру, с помощью PowerShell по HTTP протоколу, скачаем архив с дистрибутивом Ubuntu:
Invoke-WebRequest -Uri https://aka.ms/wsl-ubuntu-1604 -OutFile ~/Ubuntu.zip -UseBasicParsing
Размер архива около 200 Мб. Распакуем его:
Expand-Archive ~/Ubuntu.zip ~/Ubuntu
Исходный архив можно удалить:
Remove-Item Ubuntu.zip
Для запуска установки дистрибутива достаточно запустить файл:
Ubuntu.exe
Запустится мастер установки, который в том числе попросит указать имя пользователя и пароль, который вы будете использовать для доступа к середе Linux (эта учетная запись не связана с Windows и входит в группу sudoers, таким образом ей разрешено использовать команду sudo для установки пакетов)
Запустим обновление дистрибутива:
sudo apt-get update
sudo apt-get upgrade
Чтобы выйти из командой оболочки Linux и вернуться в PowerShell, наберите:
Exit
Открыть shell в любой момент можно командой:
bash
Имеется возможность запускать команды Linux из консоли Windows и наоборот. К примеру, в консоли PowerShell можно вывести список файлов в каталоге командой ls. Формат команды должен быть такой:
bash -c “ls -la”
Чтобы из Linux вызвать команду Windows, формат должен быть такой:
cmd.exe /c dir
Примечание. Обратите внимание, что при запуске исполняемых файлов Windows нужно обязательно указывать расширение и соблюдать регистр имени оригинального файла.
Нужно отметить, что из Linux можно запускать только те исполняемые файлы Windows, которые описаны в специальной переменной окружения. Чтобы добавить в переменную окружения новый путь, выполните команду:
export PATH=$PATH:/mnt/c/Windows/System32
Теперь можно вызвать любой файл из каталога %WinDir%\system32.
Чтобы передать параметр на вход исполняемого файла, нужно воспользоваться такими конструкциями:
$notepad.exe “C:\temp\test.txt”
$notepad.exe C:\\temp\\test.txt
Все исполняемые файлы в этом случае запускаются в контексте учетной записи, запустившей bash.exe.
Итак, подсистему WSL можно использовать для тестирования, разработки и запуска утилит Linux, недоступных в Windows окружении без необходимости развертывать и настривать отдельную виртуальную машины с Linux.
How-To
Hands-On with WSL: Installing Windows Subsystem for Linux on Windows Server
The recent release of Windows Server 2016 version 1803 allows WSL to be installed on it. Tom Fenton steps you through the process.
Windows Subsystem for Linux (WSL) has been available for Windows 10 since 2017, and in a previous article I showed you how to install WSL on Windows 10. The recent release of Windows Server 2016 version 1803 (released April 30, 2018) allows WSL to be installed on it, and in this article I’ll show you how.
Although WSL is now available for Windows Server, getting a build of Windows that supports WSL can be challenging as the only production versions of Windows Server that are currently available to most users are pre-1803 builds (Figure 1). In order to get a version of Windows Server that supports WSL, you need to be either running a Windows Insider Program for Business or using a Semi-Annual Channel build, which is only available to Software Assurance or Microsoft Cloud customers.
Figure 1. The supported versions of Windows Server.
I used my Windows Insider Account to download Windows Server Insider preview build 17650, and installed it as a virtual machine (VM) with 2 vCPUs and 8GB of RAM on vSphere 6.5. After Windows Server was installed, I verified that I was running a version of it that supports WSL by entering winver from the command line. Figure 2 shows the results.
Figure 2. After entering winver into the command-line, this dialog window shows what version of Windows Server is running.
Like many other features, WSL can be installed from the Server Manager. To do this, bring up the Server Manager, then take the following steps: select Add roles or features, select Role-based or feature-based installation, select your local server and then click Next on the Select Server Roles page. On the Select features page select Windows Subsystem for Linux (Figure 3) and, finally, on the confirmation page click Install. I had to restart my system after WSL had finished installing.
Figure 3. WSL feature.
After restarting my server, I logged back in and entered WSL on the command prompt and was informed that WSL was working but no Linux distributions were installed (Figure 4). It instructed me to go to https://aka.ms/wslstore; however, this message appears to be an error as this Web site does not exist. Alternatively, I was able to enter https://aka.ms/wsl-ubuntu-1604 on my Web browser and download Ubuntu for WSL. If you want to download OpenSuse, use the URL https://aka.ms/wsl-opensuse-42, and for SLES 12, use the URL https://aka.ms/wsl-sles-12.
Figure 4. There’s no Web site for this URL.
Once the Ubuntu file was downloaded, I extracted it and double clicked ubuntu; when presented with a dialog indicating Windows Defender SmartScreen prevented an unrecognized app from starting, I clicked Run anyway (Figure 5). It took few minutes to install, and I was then presented with a prompt to enter a user and set the user’s password (Figure 6).
Figure 5. Installing Ubuntu.
Figure 6. Setting the new user’s password.
Once Ubuntu had finished installing and I had created a user, I could then enter wsl on the command prompt and use the WSL bash shell to perform various functions. To see some of the things that you can do with WSL, be sure to read my articles about executing daily tasks, running graphical apps and other features and apps that work with WSL.
About the Author
Tom Fenton has a wealth of hands-on IT experience gained over the past 30 years in a variety of technologies, with the past 20 years focusing on virtualization and storage. He previously worked as a Technical Marketing Manager for ControlUp. He also previously worked at VMware in Staff and Senior level positions. He has also worked as a Senior Validation Engineer with The Taneja Group, where he headed the Validation Service Lab and was instrumental in starting up its vSphere Virtual Volumes practice. He’s on X @vDoppler.
INTRODUCTION
Windows Subsystem for Linux (WSL) is a feature of Windows that allows developers to run a Linux environment without the need for a separate virtual machine or dual booting. There are two versions of WSL: WSL 1 and WSL 2. WSL 1 was first released on August 2, 2016, and acts as a compatibility layer for running Linux binary executables (in ELF format) by implementing Linux system calls on the Windows kernel. It is available on Windows Server 2016, 2019 and 2022. In this tutorial, we will learn how to enable Windows Subsystem for Linux (WSL) feature to use Linux on Windows Server 2016, 2019 and 2022.
Prerequisites
-
Windows Server
-
PowerShell with Administrator rights
-
Internet connectivity
Step 1. Login to your Windows Server
Step 2. Open PowerShell as an Administrator
Step 3. Run the following command to enable Windows Subsystem for Linux
Step 4. In this tutorial, we will be creating the subsystem for Ubuntu.
Run the following command to download Ubuntu 18.04
Step 5. Enter new UNIX username: (to create a new user)
Enter the password for the user.
Installation successful.
Step 6. Windows resources are mounted on [/mnt/c] which can be accessed by
Step 7. To access Linux resources with root priviledge, us sudo command
Thank You!
Microsoft has rolled out its latest Windows Server preview build for PC users. The company released build 16257 on the Windows Insider Program. The major talking point about this Redstone 3 build is it comes with Windows Subsystem for Linux (WSL) integrated.
Windows Server has recently moved into the same update model as Windows 10. For the latter, Microsoft has been treating Windows 10 as a service. This means regular updates with new features, as well as fixes. Windows Server was moved to the same model last month, letting users test new features before they launch.
With WSL now built in, Windows Server users get the compatibility layer for running Linux binary executables on Windows. This important for developers and admins who run Linux alongside Microsoft tools like PowerShell.
Microsoft launched WSL with the Windows 10 Anniversary Update, but it comes to Server for the first time.
In its announcement, the company explained how WSL works:
“If you’re a server engineer that needs to run node.js, Ruby, Python, Perl, Bash scripts or other tools that expect Linux behaviors, environment or filesystem-layout, the ability to install and run Linux with WSL expands the tools at your disposal on Windows Server.
Just as with WSL on Windows Client, you can run daemons and jobs like MySQL, PostgreSQL, sshd, etc., via an interactive shell, but you cannot currently use WSL to run persistent Linux services, daemons, jobs, etc. as background tasks.”
More Features
Preview Build 16257 also comes with Remote Server Administration Tools (RSAT). This feature gives users the ability to remotely manage Windows Server builds on the Inside. For this addition, users will need to be running Windows 10 Fall Creators Update (Redstone 3) 16250 or higher.
Microsoft also confirmed today it is using Delivery Optimization as its update tool for Windows Server. Windows Update has been using the feature since the Anniversary Update. It allows peer-to-peer bandwidth optimization.
Luke Jones
Luke has been writing about Microsoft and the wider tech industry for over 10 years. With a degree in creative and professional writing, Luke looks for the interesting spin when covering AI, Windows, Xbox, and more.

How To Enable Windows Subsystem For Linux On Windows 10 Wsl is available for windows server 2016 1803, but i have not found any useful description of how to upgrade my fully up to date 1607 version to 1803. has anyone done this? if so, can you post how you did it?. 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.

How To Enable Windows Subsystem For Linux In Windows 10 Better Tech Tips I am using windows edition 1607 on windows server 2016. i need to enable the ‘ windows subsystem for linux’. i am unable to find this option in the add features option. you can view the screenshot. In this tutorial, we will learn how to enable windows subsystem for linux (wsl) feature to use linux on windows server 2016, 2019 and 2022. step 1. login to your windows server. step 2. open powershell as an administrator. step 3. run the following command to enable windows subsystem for linux. step 4. Enable the windows subsystem for linux (wsl) optional feature by opening powershell as an administrator and running the following command: enable windowsoptionalfeature online featurename microsoft windows subsystem linux. after executing the command, reboot your server to activate the changes. With the latest windows server insider preview build 18945, you are also able to run wsl 2 on windows server. in this blog post, i am going to show you how you can install the windows subsystem for linux 2 (wsl 2) on windows server.

Windows Subsystem For Linux Option Not Showing Up In Windows Server Enable the windows subsystem for linux (wsl) optional feature by opening powershell as an administrator and running the following command: enable windowsoptionalfeature online featurename microsoft windows subsystem linux. after executing the command, reboot your server to activate the changes. With the latest windows server insider preview build 18945, you are also able to run wsl 2 on windows server. in this blog post, i am going to show you how you can install the windows subsystem for linux 2 (wsl 2) on windows server. Click start > settings > update & security > for developers. select the developer mode radio box then click yes. press windows key r then type: optionalfeatures.exe then hit enter. scroll down then check off windows subsystem for linux then click ok. restart when the installation is complete. press windows key x. click command prompt. Before you can run linux distros on windows, you must enable the “windows subsystem for linux” optional feature and reboot. open powershell as administrator and run the syntax (commands) below. enable windowsoptionalfeature online featurename microsoft windows subsystem linux. Want to use the windows subsystem for linux on windows server? this is how you install wsl on windows server 2016 and. Windows subsystem for linux arrived in windows server insider build 16237. follow our new windows server wsl installation instructions to get started running linux alongside cmd and powershell on your servers.