Recently had a question related to WSL2. Somehow stumbled on WSL2 installation Windows Server and got shocked. There were no clear directions, even on the Microsoft page, the installation guide was quite confusing. So, here is the simplest possible way to install WSL2 on Windows Server 2019.
Install WSL2 on Windows Server 2019
If you are applying the method then you will need to have Windows Server 2019 version 1709 or later.
NOTE: if you don’t know your Windows Server version then you will go to Start > Settings > System > About. There you will find Device specifications > System type and under Windows specifications, you will find all the info needed.
Related Topic: How to install WSL2 on Windows 10?
1: Install WSL1 on Windows Server
The first step will be to install or enable WSL1. Since the WSL1 is present as default then you will need to just enable it. For enabling it, you will run CMD or PowerShell as administer. Then you will use the command below to enable it.
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
For installing additional components, you will use this command.
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
Installing the components are totally optional. Once the installation got completed then you will reboot your system. since after the installation there won’t be major changes to notice, so you can use the command below to check for the installation of WSL on Windows Server.
Get-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
2: Download Linux Distribution
The best way of downloading any Linux distribution is to use Microsoft Store. We have also used Microsoft Store for installing WSL2 on Windows 10 too. Since most of the Windows Servers use Long-Term Servicing (LTSC) desktop OS SKU and have no support for Microsoft Store or can’t access the Store due to Corporate network or admin permit they can use any of the other methods.
There is a manual option to download the Linux distro which is to use the direct links below. Click on any of the direct links and start downloading the Linux distro.
- Ubuntu 20.04
- Ubuntu 20.04 ARM
- Ubuntu 18.04
- Ubuntu 18.04 ARM
- Ubuntu 16.04
- Debian GNU/Linux
- Kali Linux
- SUSE Linux Enterprise Server 12
- SUSE Linux Enterprise Server 15 SP2
- openSUSE Leap 15.2
- Fedora Remix for WSL
Download with CDM
If don’t like downloading them from the direct links then you can use CMD or PowerShell for the purpose too. You can either use this command:
Invoke-WebRequest -Uri https://aka.ms/wslubuntu2004 -OutFile Ubuntu.appx –UseBasicParsing
Or this one.
curl.exe -L -o ubuntu-2004.appx https://aka.ms/wsl-ubuntu-2004
Both commands work fine and the files are totally the same. As both of them uses the exact same server.
Related Topic: How to Download Linux Subsystem for Windows
3: Extraction of the Linux Distros
If you have used the second command for downloading the setup file, then you will probably have a “.exe” file that requires no extraction. You will create a directory by this command:
If you got zip file format, then you will extract it with the command below after creating the directory by the command above.
Expand-Archive c:\users\administrator\Ubuntu2004.zip C:\Linux\UbuntuExpand-Archive .\Ubuntu.zip .\Ubuntu
4: Launch the setup file
Now you are going to launch the files by the command below:
Loading will take place, this might take a while. After the installation, a prompt will appear that will ask you to create a new user and assign it a password.
NOTE: this is not a root user, so make sure the user name is in lower case only.
5: Update on Linux
Here you are going to update your package catalog with Sudo apt update and if you are on Ubuntu/Debian then you will use Sudo apt upgrade. Make sure you are using the sudo, to avoid any issue during the installation.
Soon you will receive a prompt asking for the password of the account that you have created recently.
6: Set WSL 2 on Windows Server
Now that you are here, it means that you have successfully completed almost 94% of the tasks. Here you are going to give it the final touch which will set the Linux distro which is our topic here “install WSL2 on Windows Server 2019”.
To change the version of the Linux distro, you will use the command below:
wsl --set-version Ubuntu-2004