Installing WSL with GUI using VcXsrv

Windows Subsystem for Linux is a feature in Windows 10 where you can install and run Linux applications on Windows 10. Though keep in mind that WSL also have limitations such as it can only be run on 64 bit Windows 10. So if you only need to test some small program, WSL might be a solution for you since it runs fast and doesn’t take much memory on your computer.

In this tutorial I will show you how to install WSL and Graphical User Interface for WSL using VcXsrv.

First, you have to make sure your computer runs Windows 10 64 bit, and updated to the latest version of Windows. Then you can enable WSL feature by going to Turn Windows features on or off from Programs and Features as marked below. You might need to restart your computer after that.

Now open Microsoft Store and choose your favorite Linux Distro. For this tutorial I’m going to install Ubuntu 18.04.

And then run WSL, you might need to enter username and password for the first time, and then update it to the latest version :

$ sudo apt-get update
$ sudo apt-get upgrade

Congratulations!!!! You have WSL installed on your Windows.

And now we’re going to the graphical part. To do this we need VcXsrv. VcXsrv is a Windows X-server based on the xorg git sources (like xming or cygwin’s xwin). You can download it from https://sourceforge.net/projects/vcxsrv/

After installing VcXsrv, let’s start XLaunch and do some setup. First you can choose whether you like One Large Window or Fullscreen option, then choose Start no client, and then check Disable access control. When finished, you will see big window blank screen appear.

Now let’s install Desktop Environment for your WSL. I’m going to use XFCE4 since it’s lightweight, but you may want to try the other such as KDE, GNOME, LXDE, Cinnamon, MATE, etc.

$ sudo apt-get install xfce4

After the installation finished, make sure you’re in your home directory. Edit .bashrc for some configuration.

$ cd ~
$ nano .bashrc

Go to the last line and write this :

export DISPLAY=:0.0

Exit your WSL and run it again.

The format of this command is actually [host]:<display>.[screen] where [host] refers to a network host name. Since we left it blank, we’re going to use our local machine instead. Each host can have multiple display.

Now after we got everything we need, let’s start the session

$ startxfce4

Congratulations, again!!!! Now you can use your WSL using Graphical User Interface.

Remember, you can do some small things in here. But just don’t expect that you can have a fully “Linux Experience” with this method.

Officially a Software Engineer

Officially a Software Engineer