My programming ramblings

Using the Windows Subsystem for Linux with Xfce 4

Posted on April 16, 2017 by Paul

In my previous article, I’ve shown you how to install WSL, the Windows System for Linux, on a fresh Windows 10 Creators Update. Officially, at the time of this writing, WSL supports only command-line applications. However, you can install graphical Linux applications and run these under WSL if you have an X server like VcXsrv or Xming, on your Windows machine.

Assuming that you have a working WSL installation, start Bash on Ubuntu on Windows, or open a Command Prompt and type bash in it. First step is to install a window manager. From my experience, Xfce works reasonably well with WSL:

1 sudo apt install xfce4

Next, you will need to modify the .bashrc file. There are a few text editors that work under WSL. I suggest to use vim or nano, e.g.:

1 cd ~2 nano .bashrc

The second command from above will open .bashrc in nano and you can scroll to the end of the file and write:

1 exportDISPLAY=:0.0

Save the modified file by pressing CTRL+X and answering Y when asked if you want to save the file. Close and restart the console window.

Next, you will need to install an X server for Windows. I suggest VcXsrv which works well with WSL. Download and start the installer, you can safely accept the default settings.

After installation, start the XLaunch program and check One Large Window:

Some readers reported an error message for the first run of the system, something about VcXsrv fatal error. This usually means that the VcXsrv installer started a background VcXsrv process at the end. You can stop it from the Windows task manager or simply restart your computer. This happens only the first time you run VcXsrv, after a fresh installation. After reboot, start bash and XLaunch as described above.

Keep in mind that running graphical Linux applications is not officially supported by Microsoft, this means that if you find an error you are on your own.

The default Xfce browser doesn’t seem to run under WSL. I suggest to install Firefox if you need a Linux web browser. Open the Terminal application, from the Xfce bottom panel, and write:

1 sudo apt install firefox

Here is Firefox running on my machine on Xfce and WSL:

If you want to learn more about the Linux command-line applications, I would recommend reading The Linux Command Line by William E.Shotts Jr.

Disclaimer:All data and information provided on this site is for informational purposes only. solarianprogrammer.com makes no representations as to accuracy, completeness, currentness, suitability, or validity of any information on this site and will not be liable for any errors, omissions, or delays in this information or any losses, injuries, or damages arising from its display or use. All information is provided on an as-is basis. solarianprogrammer.com does not collect any personal information about its visitors except that which they provide voluntarily when leaving comments. This information will never be disclosed to any third party for any purpose. Some of the links contained within this site have my referral id, which provides me with a small commission for each sale. Thank you for understanding.