Advance

How to Run Linux with WSL on Windows Server 2019

How to Run Linux with WSL on Windows Server 2019
1
(1)

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.

 

Prerequisites:

Install Windows Server 2019

Recommended Article: Tutorial Install Python 3 on RHEL 8 / CentOS 8

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:

 

How to Run Linux with WSL on Windows Server 2019

 

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:

 

How to Run Linux with WSL on Windows Server 2019

 

e- The sudo command can be used for privileged operations.

sudo apt update && sudo apt upgrade  sudo apt install ansible

Sample output:

How to Run Linux with WSL on Windows Server 2019

 

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.

ubuntu1804.exe

You will see the following image:

 

How to Run Linux with WSL on Windows Server 2019

 

Note: Other Linux distributions that you can run are:

Ubuntu 18.04 ARM

Ubuntu 16.04

Debian GNU/Linux

Kali Linux

OpenSUSE

SLES

 

 

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.

Goodluck.

How useful was this post?

Click on a star to rate it!

Average rating 1 / 5. Vote count: 1

No votes so far! Be the first to rate this post.

We Are Waiting for your valuable comments and you can be sure that it will be answered in the shortest possible time.

Leave a Reply

Your email address will not be published. Required fields are marked *

We are by your side every step of the way

Think about developing your online business; We will protect it compassionately

We are by your side every step of the way

+8595670151

7 days a week, 24 hours a day