Overview
Windows Subsystem for Linux allows you to install a lightweight distribution of Linux on your Windows 10 PC
You don't get a Linux desktop environment, but you do get a command-line interface and a full collection of development tools.
For an official overview of how this works, see this MSDN blog post.
Simply put, WSL translates linux kernel system calls into equivalent NT ones, letting Linux binaries work unmodified on a running Windows 10 system.
Installing WSL
See the official Microsoft instructions, but in essence:
- Open Powershell as Administrator and run Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
- Open the Microsoft Store and search for 'Run Linux on Windows'
- Select and install your distribution of choice
- Run the distribution from the Start menu, or by running <distro>.exe from the command prompt (eg. ubuntu.exe)
- The first run will take a few minutes to unpack the distribution, then prompt you to set up a Linux username and password to use.
- You will now be at a bash prompt, ready to go.
- It's probably a good idea to do a software update immediately - on Debian or Ubuntu, run sudo apt-get update && apt-get upgrade
Using WSL
From the Bash prompt, you can use all the standard command-line software that comes with Linux, or add your own via apt-get or equivalent.
The environment will have a self-contained Linux filesystem, but your Windows drives will be mounted and accessible under /mnt/c, /mnt/d, etc.
Running graphical programs under WSL
Although running graphical applications under WSL isn't directly supported by Microsoft, most of them will work fine.
However, this will take a little extra setup to get going:
- First, you will need to download and install an X server for Windows.
- Once that's done, you'll need to edit your .profile file:
- Start up your Linux distribution and run nano ~/.profile
- Scroll to the bottom of the file and add the line export DISPLAY="localhost:0.0"
- Exit and restart your distribution (or just source ~/.profile)
- You can now install packages such as gedit, and have graphical Linux applications pop up on your Windows desktop
- You should also be able to SSH to other Linux machines and run graphical applications there as well
- This will require that you use the -Y flag to ssh - eg: ssh -Y z1234567@login.cse.unsw.edu.au