Microsoft seems to prefer you installed WSL through their Windows Store, but the problem is that this Store does not exist on the server versions of Windows 10. This gist is therefore my notes on how to install it manually, using PowerShell.
The official guide is already quite short and informative, so this will basically just be a recap with some informative notes throughout.
- Start PowerShell as an Administrator by opening the start menu and right clicking the program.
- Execute the following command:
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
- Reboot
- Go to this link and download the Linux distro you want.
- Rename the downloaded
.appx
file to.zip
and extract it. - Move this extracted folder somewhere you would like on you computer
(e.g.
~/WSL/Ubuntu
) - Run the
.exe
file that is located inside this folder (e.g.~/WSL/Ubuntu/ubuntu.exe
) - Wait for installation to finish and then add a user and a password for the Linux environment.
⚠️ Do not move or rename this folder, as this will break the file system used by the distro.
You can now start this environment by just typing bash
inside a PowerShell
terminal. For additional modifications that can be made, read the info about
multiple distros below.
ℹ️ For your own sanity I would recommend turning off the notification sound that the terminal makes every time you
tab
orbackspace
wrong. Uncomment the lineset bell-style none
in the/etc/inputrc
file while inside the Ubuntu environment.
You may extract and install all the available distributions from the
official list, however, only one of them will be launched when you type
bash
in a PowerShell terminal. The one that is started is the (Default)
environment, and it can be identified by executing:
wslconfig /l
- Changing the default may be done through the following command (
Ubuntu-18
comes from the command above)
wslconfig /s Ubuntu-18
- When multiple environments are available, you may want to add all the distro
paths to the Windows environment PATH. Here I use
C:\Users\Administrator\Ubuntu
as an example of one distro's path).
$userenv = [System.Environment]::GetEnvironmentVariable("Path", "User")
[System.Environment]::SetEnvironmentVariable("PATH", $userenv + "C:\Users\Administrator\Ubuntu", "User")
You may now start the Ubuntu environment by typing ubuntu.exe
inside a
PowerShell terminal. Adding more paths will then allow you to start each
separate environment by then typing the .exe
name.
If you have not moved the folder where the distro is installed, removing it is easy.
- List all installed distros by running the following from a PowerShell terminal:
wslconfig /l
- Remove any of the above listed by running the following (
Ubuntu-18
comes from the listing):
wslconfig /u Ubuntu-18