Skip to content

Deploy On-Premise Infra on WSL2

WSL2

This tutorial explains how to setup the entire OctoPerf On-Premise Infra platform using Windows Subsystem for Linux.

The Windows Subsystem for Linux (WSL) is a solution that allows running a Linux environment directly on Windows, using a terminal, with no third party Virtual Machine solution is required.

We're going to use its latest version, WSL2, which goes further beyond in terms of integration and simplicity.

Prerequisites

This tutorial requires:

  • A physical machine or server (NOT a virtual machine),
  • Windows 10 or Windows Server 2019 (version 1709 or greater),
  • Basic knowledge of Microsoft Windows,
  • Basic knowledge of Linux,
  • And basic knowledge of how Docker works.

Installing WSL2

First, we need to activate WSL2 on your Windows machine. Open a PowerShell terminal in Administrator mode:

Powershell1

Enter the following command to enable WSL 1 :

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all

Powershell2

Reboot your machine. Open PowerShell in admin mode again, and type the following command to enable WSL2:

dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all

Powershell3

Reboot your machine again.

You now have WSL2 installed on your machine.

Installing Ubuntu

We are now ready to install Ubuntu on your Windows machine.

If you have access to the Windows Store

Open the Microsoft Store to download and install Ubuntu:

storeubuntu

Open a PowerShell terminal in admin mode, and set WSL2 as the default option:

wsl --set-default-version 2

To check if your linux distribution is indeed using WSL2, type the following command:

wsl --list --verbose

Powershell4

If it's not the case, enter this command to correct the configuration:

wsl --set-version Ubuntu 2

You now have Ubuntu on your Windows Server, it can be launched directly from the Windows Start Menu, like any other program.

If you don't have access to the Windows Store

You might not have access to the Internet on your machine, for instance if you're using installing WSL2 on a Windows Server located in a private network.

First, you will need to download the distribution on a machine that has access to the internet, and transfert the "appx" file to your server.

The distributions are available on this page :

https://docs.microsoft.com/fr-fr/windows/wsl/install-manual

Extract the appx file using Powershell, let's say it is named Ubuntu2004.appx :

Rename-Item .\Ubuntu2004.appx .\Ubuntu2004.zip 
Expand-Archive .\Ubuntu2004.zip .\Ubuntu

Execute the .exe file extracted in the target directory to install the distribution

$userenv = [System.Environment]::GetEnvironmentVariable("Path", "User") [System.Environment]::SetEnvironmentVariable("PATH", $userenv + ";C:\Users\Administrator\Ubuntu2004", "User")

You can now launch your distribution by typing "Ubuntu2004.exe" from any path.

Installing Docker-CE on Ubuntu

After launching Ubuntu, see documentation explaining how to install docker-ce on Ubuntu.

You can now start docker, with the following command:

sudo service docker start

You can access your local Windows drives directly from Ubuntu, by accessing the following directory:

cd /mnt/

Warning

If the docker service fails to start, you might want to try the following command: update-alternatives --config iptables And select the legacy option (usually 1). Now the docker service should start without any issue.

Install the On-Premise Infra

The next steps are similar to a classic On-Premise Infra install on Unix, so please refer to our documentation on the subject: