Azure Dev Resources

WSL + Ubuntu

Home

The resources required to conduct the following steps are generated by the Build-WslCache.ps1 script. These resources can then be transported to a disconnected network and used to enable WSL with Ubuntu.

https://learn.microsoft.com/en-us/windows/wsl/install-manual

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

# enable virtual machine feature
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

Restart the target machine. The remaining steps will not work properly if the machine is not restarted.

Download and install the WSL2 Linux kernel update package for x64 machines. This is listed as wsl-kernel-<arch>.msi in the generated bundle/wsl directory.

The following will not work properly if the machine is not restarted

# Set WSL2 as your default version
wsl --set-default-version 2

Copy the bundle/wsl/ubuntu directory to the target machine. Double-click bundle/wsl/ubuntu/ubuntu.exe to initialize the distro with a username and password. The distribution will then be connected to WSL. You can set it as the default distro with:

wsl -s Ubuntu

You can also setup a Terminal profile by modifying the settings JSON file:

{
    "guid": "{<guid>}",
    "hidden": false,
    "name": "Ubuntu",
    "source": "Windows.Terminal.Wsl"
}

Home