Windows Subsystem for Linux (WSL) allows you to run a Linux based terminal from inside a Windows Machine. It can be setup with most Linux distros such as Ubuntu, Debian, Kali, etc. For this particular guide, it will be WSL 1 installed on Windows Server 2019.
- On your Windows Server machine, open the Server Manager tool
- In the top right, click 'Manage' then 'Add Roles and Features'
- On the 'Before You Begin' page, click 'Next'
- Select 'Role-based or feature-based installation' on the 'Installation Type' page
- In the 'Server Selection' page, choose the 'Select a server from the server pool' option and select the current server you are on
- In the 'Server Roles' page, there is no need to add any additional roles, don't select any new roles.
- In the 'Features' page, tick the 'Windows Subsystem for Linux' option.
- On the confirmation page, ensure that Windows Subsystem for Linux has been chosen, and press Install at the bottom
- Afterwards, you will need to restart your machine for the installation to complete.
- Once the machine has restarted, use the following link to download your desired Linux distro. https://learn.microsoft.com/en-us/windows/wsl/install-manual#downloading-distributions
- The download should appear as an .AppxBundle file, which can be extracted using 7zip.
- In the extracted folder, copy the _x64.appx file to the location in which you'd like the Linux distro to be setup. The below example screenshot is using Ubuntu 22.04 as an example
- In the new location where the _x64.appx file has been copied, rename the file so that the file extension is changed from .appx to .zip (see below)
- Extract the zip file
- Run the <distro name>.exe file. Using Ubuntu as an example, the file would be ubuntu.exe (see below)

- This will open a terminal in which you will need to set a username and password for the Linux user
- Once the username and password have been set, close the terminal.
- In the Windows Start menu, search for environment variables and click on the "Edit the system environment variables" item
- Press the 'Environment Variables' button at the bottom and in the new window that appears double click the 'Path' variable from the list of System variables NOT User variables.
- In the 'Edit environment variable' window, click 'New' and add the path to the folder containing the Linux distro executable. For the examples above it would be
"C:\Users\Administrator\AppData\Local\Ubuntu_2204.1.7.0_x64\"
and press Ok at the bottom of each of the windows.
- You should now be able to run the Linux distro from a command prompt or Powershell regardless of the location by typing the name of the distro executable
- By default, the starting directory when running a Linux distro will be the /home/<user> directory. If you want to access files on your Windows machine you will need to cd into the '/mnt' directory. This will give you access to the disks on your Windows Server machine
- Typing the command 'exit' will return you back to the Windows Command prompt
Having WSL can be useful for running Linux commands that aren't natively available in the Windows Command prompt, such as:
- openssl - To generate keys and certificates. Decrypt and encrypt data. Test SSL and TLS connections
- grep - For finding text within large files. Using text patterns to search in files. Useful when searching through large Replicate logs
- split - To split large files into smaller chunks. This can be especially helpful when dealing with large Replicate log files which can't be opened by text editors.