Get WSL2 working on Windows 10

Jordan Lee
Sep 6, 2019 · 5 min read

Unless you’ve been living in a cave devoid of technology for the last year, you’ve likely already heard of (and tried) Windows Subsystem for Linux (WSL). As per Microsoft’s documentation:

The Windows Subsystem for Linux lets developers run a GNU/Linux environment — including most command-line tools, utilities, and applications — directly on Windows, unmodified, without the overhead of a virtual machine.

Basically, it’s a compatibility layer for the Linux kernel, allowing you to run Linux binaries in Windows.

WSL2 takes this one step further, by including the actual Linux kernel running in a light-weight virtual machine. One of the best things about this is significantly better file I/O performance and full system call compatibility — meaning you can do things like running Docker.

Here’s the instructions for setting up WSL2 on Windows 10.

Enable Windows Insider Program

  • Sign up to the Windows Insider program.
  • Update Windows
  • Enable the features required for WSL2:
    - Microsoft-Windows-Subsystem-Linux
    - VirtualMachinePlatform

To do this in PowerShell (Administrator mode):

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-LinuxEnable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform
  • Set WSL2 as the default.
PS C:\WINDOWS\system32> wsl --set-default-version 2
For information on key differences with WSL 2 please visit

Install a Distro

App Store Install

The easiest way to do this is through the Microsoft Store. Just search for ‘Linux’ and select your distro of choice.

In this example, I chose Ubuntu. After install completes, you’ll see Ubuntu available as an App in the Start menu:

Manual Install

If you aren’t able to access Microsoft Store - maybe due to corporate firewalls - you can download a distro and manually add them into WSL. Distros are distributed as .appx files.

Let’s take a look at Fedora Remix for example — You can download this distro from Whitewater Foundry’s GitHub release page.

Once you’ve downloaded a distro file, you can install it using the Add-AppxPackage cmdlet.

PS G:\downloads\os> Add-AppxPackage .\DistroLauncher-Appx_1.30.1.0_x64.appx

Once install completes, you’ll see Fedora Remix available in the Start menu:

Whichever way you used to install a WSL distro, once its installed you can run it like you would a regular app.

You’ll be first prompted to set up a default account. Once this is done, you’re ready to start installing and running whatever you want.

Run GUI applications in WSL with X11 Forwarding

If you want to run graphical applications in WSL, the easiest (and most resource-efficient) way to do this is with X11 forwarding.

Install X11 Server

There’s a few available for Windows:

VcXsrv is open source, free, and does what it’s meant to — so that’s what I went with.

Start it up and just keep clicking ‘Next’ (use defaults for everything).

Next, we want to find the Display settings. You can do this by examining the logs. There’ll be an entry with something like DISPLAY=

Set up SSH server in WSL Distro

To use X11, you’ll need to set up an SSH service in the WSL distro you’ve just installed.

This is pretty straightforward in Ubuntu.

# Remove the default install
apt-get remove --purge openssh-server
# Update
apt-get update
apt-get upgrade -y
# Install OpenSSH Server
apt-get install -y openssh-server

Set the following in ssh config:

# Configure OpenSSH
# vim /etc/ssh/sshd_config
Port 222
X11Forwarding yes
X11DisplayOffset 10

Finally, start the OpenSSH server.

service ssh start

Test it out!

Using an SSH client like Putty, SSH into your WSL distro.

As Tanmay Garg pointed out, on WSL2 the IP address will be unique, as the distro is effectively running in its own virtual machine.

To get the IP address of the WSL distro, use the ifconfig command.

jordan@JORDAN-HOME:~$ ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet netmask broadcast
inet6 fe80::215:5dff:feb8:4d44 prefixlen 64 scopeid 0x20<link>
ether 00:15:5d:b8:4d:44 txqueuelen 1000 (Ethernet)
RX packets 54543 bytes 74072152 (74.0 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 24650 bytes 1977511 (1.9 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet netmask
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

The port will be 222 (previously set in /etc/ssh/sshd_config).

Make sure to enable X11 Forwarding, setting the X display location to the address listed in the VcXsrv log.

Once logged in, start a graphical application (e.g. gvim). If you’ve set everything up correctly, you’ll see the application in a new window.

The Startup

Get smarter at building your thing. Join The Startup’s +792K followers.

Sign up for Top 10 Stories

By The Startup

Get smarter at building your thing. Subscribe to receive The Startup's top 10 most read stories — delivered straight into your inbox, once a week. Take a look.

By signing up, you will create a Medium account if you don’t already have one. Review our Privacy Policy for more information about our privacy practices.

Check your inbox
Medium sent you an email at to complete your subscription.

Jordan Lee

Written by

The Startup

Get smarter at building your thing. Follow to join The Startup’s +8 million monthly readers & +792K followers.

Jordan Lee

Written by

The Startup

Get smarter at building your thing. Follow to join The Startup’s +8 million monthly readers & +792K followers.