Install and activate Windows subsystem for Linux (WSL) 2 on Windows Server

WSL 2 can currently only be installed on the latest Windows Server insider preview, or on Windows 10 build 18917 or higher. In this post I will explain how to install WSL 2 on Windows Server 2019.
Latest posts by Vladan Seget (see all)

It is already the second release of Windows Subsystem for Linux (WSL) that Microsoft released a short time ago. This release offers a new architecture that changes the way in which the Linux distribution interacts with the underlying Windows OS.

WSL 2 has better performance and full system call compatibility. It uses virtualization technology (based on Hyper-V) and a lightweight utility VM on a real Linux kernel. You will need to install two components: the WSL and the Virtual Machine platform optional component.

The Linux kernel in WSL 2 is built by Microsoft from the latest stable branch of the source available at kernel.org. This kernel has been specially optimized for WSL 2 in terms of size and performance to get the best possible Linux experience on Windows. The kernel will be updated via Windows updates, so you'll get the latest security fixes without worrying by patching this separately.

To get access to Windows Server 2019 19035, you'll have to join the Windows Insider program  at Microsoft and select 'Fast' ring or 'Slow' ring. You can join for free.

The first thing to do is install the WSL via PowerShell as an administrator. Open your PowerShell console and enter this command:

Then install the Virtual Machine platform optional component:

A reboot is required to ensure that WSL can initiate a trusted execution environment. Just to make sure that WSL is installed, you can confirm the installation via this PowerShell command:

The next step is to download your Linux distribution. In our example, we'll use Ubuntu.

Use this command:

Download your Linux distribution

Download your Linux distribution

When done, create a local folder where you'll extract the zip archive file:

Then extract the zip file into a folder on your local hard drive.

Create a directory and expand the zip file

Create a directory and expand the zip file

Launch the Ubuntu.exe file to install it (installation might take a while). You'll receive a prompt to create a new user and assign a password. This has to be some user other than root and the user's name has to be lowercase only.

Create a new user and assign a password for this user

Create a new user and assign a password for this user

Update the package catalog and the individual applications with the "apt update" and "apt upgrade" commands if you're on an Ubuntu/Debian distribution. You'll need to use "sudo" to elevate your privileges.

If you're new to Linux, the command would look like this:

You'll receive a prompt for a password for user vladan we created earlier.

Run a Sudo apt update command

Run a Sudo apt update command

Wait for this to finish and then run "sudo apt upgrade" to update all installed packages to the latest version. You should do this from time to time to have the latest versions installed.

You can check which Linux distributions are already installed with this command:

You can set the Ubuntu WSL to version 2 with this command:

Show all registered distributions and convert to WSL 2

Show all registered distributions and convert to WSL 2

WSL will convert the Linux distribution to version 2. WSL 2 uses an entirely new architecture that uses a real Linux kernel. It's a good idea to try to use the latest and greatest.

We can also make sure that whenever we install a new distro, it will default to version 2. To do so, just run this command via PowerShell:

You can run WSL 1 and WSL 2 distributions side by side. At any time, you can upgrade and downgrade any distribution if needed. WSL 2 as a new architecture presents a better platform but WSL as such will be improved over time. WSL is great for developers and testers when they need to work on Windows systems and develop and test Linux applications at the same time.

Want to write for 4sysops? We are looking for new authors.

Read 4sysops without ads and for free by becoming a member!

1+
avatar
Share
0 Comments

Leave a reply

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

*

© 4sysops 2006 - 2020

CONTACT US

Please ask IT administration questions in the forums. Any other messages are welcome.

Sending

Log in with your credentials

or    

Forgot your details?

Create Account