Skip to content

Instantly share code, notes, and snippets.

@alx-xlx
Last active February 25, 2020 23:33
Show Gist options
  • Save alx-xlx/82db67e2b2b06602625a0ee0bfc3d9a9 to your computer and use it in GitHub Desktop.
Save alx-xlx/82db67e2b2b06602625a0ee0bfc3d9a9 to your computer and use it in GitHub Desktop.
Install Linux on Windows Server (WSL) Windows Subsystem for Linux

Install Linux on Windows Server (WSL) Windows Subsystem for Linux

On you Windows Server

1. Open PowerShell as Administrator and run:

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

2. Restart your computer when prompted. This reboot is required.

3. Open Command Prompt and download Linux Distro

(in this case we download ubuntu 16.04)

curl.exe -L -o ubuntu-1604.appx https://aka.ms/wsl-ubuntu-1604

4. To Install Linux Distro, open Powershell

Powershell (no admin) Run

Rename-Item .\ubuntu-1604.appx .\ubuntu.zip
Expand-Archive .\ubuntu.zip .\ubuntu

5. Add linux-distro to your Windows Environment PATH

In Powershell Run

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

6. Rename ubuntu1604.exe to ubuntu.exe

(this new filename will be the command name to launch your distro)

cd ubuntu
Rename-Item .\ubuntu1604.exe ubuntu.exe

Restart your Powershell

7. Install (in powershell run)

You will be prompted to Create Username and Password (Both are Mandatory)

ubuntu

8. DONE !!

-------------------------------------------------------------------------

Extra Stuff

  • Windows C: Drive cd /mnt/c/
  • Root Permission sudo su
  • Exit exit

Installation Trouble ?

  • WSL should be enabled (To check, in powershell run) Get-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

  • Make sure you're running Windows build 16215 or later. (To check, in powershell run) systeminfo | Select-String "^OS Name","^OS Version"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment