How to Setup Ubuntu WSL in Windows Server 2019

Enable WSL

  • Run PowerShell as a Administrator (i.e. Look for “PowerShell” in windows menu and right click and click on “Run as Administrator”)
  • In the PowerShell type wsl
  • If it displays a command not found then execute the following command otherwise skip to the next section
      Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
    

Install Ubuntu WSL

  • Download the Ubuntu app bundle from https://aka.ms/wslubuntu
  • In the PowerShell change directory to the folder where the above file downloaded e.g. `cd ~\Downloads
  • Install the package using the following command
      Add-AppxPackage .\<downloaded-appxbundle-name>.appxbundle
    
  • Make sure there are no errors for the above command
  • Search Ubuntu in the in Windows Menu
  • Click “Ubuntu”
  • It will ask for a username/password enter the username of your choice (it is the root (i.e. admin) password for the ubuntu)
  • Pin the Ubuntu in the taskbar by right-clicking the Ubuntu window icon in the taskbar click “Pin to taskbar” to access it from the taskbar in future

VS Code Extention

If you are using VS Code IDE then you can install the VS Code extension for WSL by following the steps below

  • Install the extension “Remote - WSL” by Microsoft
  • Follow the steps provided in this extension

References:

WSL/WSL2 can be installed straight forward on Windows 11 or Windows Server 2022 using Store, refer the following: