Using the Windows Subsystem for Linux (WSL)

Submitted by matthiaslink on Sun, 2018-03-25 - 13:42
Penguin in Tin

Enable Windows Feature and Install Distribution

Presumptions: It must be made sure that new applications or even the manual Powershell installation is done on system drive C: so in case it was changed on your computer that new apps are installed on e.g. D: you must revert this change for installation. Settings -> Storate -> More Storage Settings: Change where new content is saved (Section: "New apps will save to:")

 

  1. Enable the Windows Subsystem for Linux within PowerShell command line

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

    Reboot after enabling of the Windows Subsystem for Linux!
     

  2. Download a userland environment
    There is now possibility to download one of multiple userland environments. You have two options, download (free downloads) via Windows Store (pro: easier, tile will be created) or download via Powershell download (pro: more control over process, no hidden / distributed files) links:
    • Ubuntu
      Windows Store: https://www.microsoft.com/store/p/ubuntu/9nblggh4msv6
      Powershell Link: https://aka.ms/wsl-ubuntu-1604
    • openSUSE Leap
      Windows Store: https://www.microsoft.com/store/apps/9njvjts82tjx
      Powershell Link: https://aka.ms/wsl-opensuse-42
    • SUSE Linux Enterprise Server - SLES
      Windows Store: https://www.microsoft.com/store/apps/9p32mwbh6cns
      Powershell Link: https://aka.ms/wsl-sles-12
    • Debian
      Windows Store: https://www.microsoft.com/store/productId/9MSVKQC78PK6
      Powershell Link: not known - please post comment if you have more information
    • Kali Linux
      Windows Store: https://www.microsoft.com/store/apps/9PKR34TNCV07
      Powershell Link: not known - please post comment if you have more Information

    openSUSE example within PowerShell command line:
    Invoke-WebRequest -Uri https://aka.ms/wsl-opensuse-42 -OutFile .\opensuse.zip -UseBasicParsing
  3. Extract the archive
    This step is necessary only in case you downloaded via the PowerShell. The extracted files must be available on system drive, according to MS documentation.
    Expand-Archive .\opensuse.zip c:\Distros\opensuse
  4. Install the linux subsystem
    Run the <distro>.exe file in the extraction directory, e.g.
    c:
    cd \Distros\opensuse
    .\openSUSE-42.exe
  5. Create necessary user / password combinations within installation process you have to create your linux user and you might set your root user password (this is something like the "admin" password.
     
  6. Update your distribution to the latest security state This step is different and very specific to the selected distribution. Some examples in the following sections.

    Debian:

    sudo apt-get update
    sudo apt-get upgrade

    or

    sudo apt-get dist-upgrade

    openSUSE:

    sudo zypper ref
    zypper up

    Please pay Attention that at the date of writing this article the store had openSUSE Leap 42.2 as installation basis for the WSL. This Version is not any more supported. So i suggest to update the openSUSE WSL system after installing (see article about installing WSL)

Run the subsystem in future

  1. [distro] ie ubuntu
  2. wsl.exe or bash.exe
  3. wsl [command] or bash -c [command]
     

Revert installation / Uninstall

Reset the distribution to a clean install ("factory reset") with running <distro>.exe with clean parameter.

openSUSE example:

c:
cd \Distros\opensuse
.\openSUSE-42.exe clean

Uninstall In case you want to uninstall the distribution, then please refer to https://docs.microsoft.com/de-de/windows/wsl/wsl-config
 

Further Information / Source

German c't magazine 22/2017 page 108

Central Mircrosoft Landing Page: https://docs.microsoft.com/de-de/windows/wsl/about

Server Installation Details: https://docs.microsoft.com/de-de/windows/wsl/install-on-server

Win10 Store Installation Details: https://docs.microsoft.com/de-de/windows/wsl/install-win10

German Zypper User Guide: https://de.opensuse.org/SDB:Zypper_benutzen

Add new comment

This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.