How to Run Linux with WSL on Windows Server 2019. Windows Subsystem for Linux stands for WSL, which is included in Windows Server 2019. Using WSL, you can run Linux distributions as well as run some Linux programs directly on Windows without creating and launching a virtual machine.
In this tutorial, we will learn how to run Linux on Windows Server 2019 using WSL, stay tuned.
Install Windows Server 2019
1) How to enable the Windows Subsystem for Linux (WSL) feature
Before you can install any Linux distribution for WSL, you must ensure that the Windows Subsystem for Linux feature is enabled:
A. Open PowerShell as Administrator.
B. Run the following command to enable WSL:
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
C. Agree to restart your computer when prompted:
Note: You can do the same from the Server Graphical Interfaces:
Server Manager >> Add roles and features >> Select features
2) How to Install your Linux Distribution of Choice
There are various ways in which you can install WSL Linux distros via the Microsoft Store. In this guide, we will use download and install one from the Command-Line.
a- Launch PowerShell and download the distro with use the Invoke-WebRequest cmdlet or using curl.exe. Here’s a sample instruction to download Ubuntu 18.04:
curl.exe -L -o ubuntu-1804.appx https://aka.ms/wsl-ubuntu-1804
b- After the download, extract and install a Linux distro.
Rename-Item ubuntu-1804.appx ubuntu-1804.zip Expand-Archive ubuntu-1804.zip ubuntu1804
c- Change your working directory to ubuntu 1804 and run the installer to finish your distro installation:
cd ubuntu1804 .\ubuntu1804.exe
d- Similar to the image below, the installer will prompt you to provide a username and password for the UNIX user to be created:
e- The sudo command can be used for privileged operations.
sudo apt update && sudo apt upgrade sudo apt install ansible
f- Add your distro path to the Windows environment PATH using Powershell:
$userenv = [System.Environment]::GetEnvironmentVariable("Path", "User") [System.Environment]::SetEnvironmentVariable("PATH", $userenv + "C:\Users\Administrator\ubuntu1804", "User")
g- This will enable you to launch your distro from any path by typing the .exe launcher. For example, using ubuntu1804.exe. Note that this will require closing and relaunching PowerShell.
You will see the following image:
Note: Other Linux distributions that you can run are:
– Ubuntu 18.04 ARM
– Ubuntu 16.04
– Debian GNU/Linux
– Kali Linux
You can also, see:
Dear user, we hope you would enjoy this tutorial, you can ask questions about this training in the comments section, or to solve other problems in the field of Eldernode training, refer to the Ask page section and raise your problem in it as soon as possible. Make time for other users and experts to answer your questions.