Microsoft’s Lightweight Linux Runtime Environment Comes to Windows Server

The Windows Subsystem for Linux — the way that Windows 10 is able to run command line Linux binaries directly, without a virtual machine — is now out of beta. The company is also introducing WSL into the Windows Server environment as well.
“We’re adding WSL to Windows Server in response to the many requests we’ve received since launching WSL on Windows client,” Microsoft’s Rich Turner told the New Stack. “Many DevOps engineers — systems engineers, administrators, and developers — want and need to deploy, manage, monitor, and maintain apps and systems that incorporate tools that run best, or only, on GNU/Linux platforms. They want to run local services to host, for example, databases and websites for local development and debugging. Being able to run one’s preferred Linux distros and tools atop WSL on Windows Server will enable dev-ops engineers to get more done on Windows Server.”
Turner describes “a very lightweight Linux runtime environment for local interactive user scenarios.” As part of the Fall Creators Update (1709) of Windows 10, WSL will be fully supported, so you can file issues through your standard Microsoft support channels (and use the Windows 10 Feedback Hub as well as the WSL issues GitHub repo).
The process for installing a Linux distro changes as well; distros for WSL now come from the Windows Store. Ubuntu, openSUSE Leap 42 and SUSE Linux Enterprise Server 12 are already available and Fedora is coming soon. Moving the distros to the Store simplifies installation and speeds up downloads (by using the Store’s content distribution network). It also means that you can run different distros simultaneously on the same machine, without reinstalling or rebooting.
Use the Windows wslconfig command to manage which distro you’re working with. The /l flag lists your installed distributions; use /setdefault <DistributionName> to choose the default distro that starts when you type bash at the command prompt. You can also type ubuntu or fedora to launch the distro you want (or use their tiles on the Start menu) — and you can use those commands in scripts to run tests across multiple distros automatically.
If you already have Ubuntu installed with WSL it won’t stop working, but you will still want to switch to the Store distributed version because distro updates will now come through the Store and at some point, the directly installed version will be deprecated. To do that, back up any files and config information you want to keep (for example make a WSL-backup folder in /mnt/c/tmp/WSL-backup/ or in your user directory (which is /mnt/c/Users/<Username>/Desktop/); if you’re moving a lot of files, tar them first. Uninstall your existing Ubuntu using the lxrun /uninstall command from the Windows command prompt or PowerShell, then install Ubuntu from the store and copy or untar your files into the new Ubuntu instance.
“If you’re moving settings between instances of the same distro family, the move should be relatively simple,” Turner notes, but he suggests using extreme caution if you’re using a different distro because the configuration systems and file locations aren’t always the same; it’s probably best to just create your settings from scratch rather than trying to save time by copying them to multiple distros.
WSL is also coming to Windows Server, as part of the Windows Server Insider program. That doesn’t change the reason WSL is in Windows; it’s still for developers using command line tools and integration with toolchains, not for running production workloads or server applications like Redis (even though they might work). And it’s not intended to replace PowerShell, which is still the way to manage server workloads and Windows Server itself.
That said, Turner also cautioned that “WSL is only for user-initiated interactive tasks, not for production service workloads. WSL was specifically built for users to run tools, locally build, deploy, and debug software, modify configuration, monitor workloads, and so on, but should not be used to host production daemon/jobs, or server workloads like Apache, Nginx, MySQL, PostgreSQL or MongoDB.”
There are performance as well as support reasons not to try using WSL for server workloads. A recent set of independent benchmarks [www.phoronix.com/scan.php?page=article&item=windows10-wsl-scaling&num=1] suggests that while general performance isn’t far off running Linux directly on the same hardware, I/O performance continues to lag (it’s an area where Microsoft is still promising improvements).
Setting up WSL on Windows Server
To start using WSL on Windows Server, make sure you’re using a Windows Insider preview build and run this PowerShell command (as administrator) from PowerShell:
1 |
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux |
The same WSL distros you can use on Windows 10 will run on Windows Server and they still come from the Windows Store on Windows Server, but you have to manually download them from the Store CDN, with the Invoke-WebRequest cmdlet. Ubuntu is at https://aka.ms/wsl-ubuntu-1604, OpenSUSE is at https://aka.ms/wsl-opensuse-42, SLES is at https://aka.ms/wsl-sles-12 and Fedora is coming soon. To download Ubuntu, the PowerShell command is:
1 |
Invoke-WebRequest -Uri https://aka.ms/wsl-ubuntu-1604 -OutFile ~/Ubuntu.zip -UseBasicParsing |
Extract the distro to a target directory on your system drive. For example:
1 |
Expand-Archive ~/Ubuntu.zip ~/Ubuntu |
Now run the installer, which is named for the distro (ubunte.exe, fedora.exe and so on), create your UNIX user and set the username and password in the same way you do for WSL on Windows 10.

Hyper-V Linux containers give you the isolation of Hyper-V with the flexibility of Docker containers and you can manage them with Linux tools now that WSL is coming to Windows Server (credit Microsoft).
If you’ve been using WSL on Windows 10 and you want to save time by copying your settings across to Windows Server, you can do that the same way as on Windows 10 — but again, stick to copying your config from the same distro to avoid problems.
Mixing Containers
WSL will be Windows Server particularly interesting if you’re running Linux containers on Windows Server using Hyper-V Containers. Think of them as midway between a container and a VM; they run in a lightweight VM with minimal services, so they have their own OS and kernel, but you don’t have to manage the VM — you just manage the Docker container.
As Microsoft’s Taylor Brown explained to us, “WSL for Windows Server is a great way to use your existing deployment scripts and tools with the container technology we’ve brought to Server. If you want to run Linux containers, here’s a way to run your Bash scripts to build and launch and debug and deploy and do Linux native things using Linux containers on Windows Server..”
That’s in addition to the Windows format Docker containers in Windows Server 2016 and Windows 10 because Microsoft customers use both. Brown encourages developers to experiment with the cross-platform. “We’ve been brainstorming what you could do with. Now that I can run Docker client in WSL if I want to and all the tools around that just come across, and now that I’ve got multiple stage builds, could I actually use a Linux container to build my Windows image or a Windows container to build my Linux image? The answer is probably yes.”
Photo by Alex Bertha on Unsplash.