Microsoft and Linux separated by a heart icon on a blue background.

Running Graphical Applications under Linux on Windows

| 0 Comments | words | minutes | Permalink

Windows 10 brings quite a few developer/geek/... friendly features to the table; a feature which haven't gotten as much attention as it deserves, is the Windows Subsystem for Linux

It allows users to run user-mode Linux applications under Windows and with a few tweaks, it is no longer limited to console applications - but to get there, we need to know some things about Linux.

X Window System

The X Window system was created at MIT in the 80's and such have been around for more than 3 decades.

The X Window System provides a basic framework for graphical user interfaces and assists developers to capture input, move around application windows on screen and more - but importantly X does not control styling.

X Window System on Wikipedia

Architecture of X

The X protocol defines how a client/server architecture is used in X which allows an administrator to hook up a *nix system with a remote system for rendering applications; although usually on Desktop machines content is rendered "localhost", this is the architecture we can now use to render the content in the Windows explorer context.

Installing Windows Subsystem for Linux

Manual way

Navigate to "Control Panel\All Control Panel Items\Programs and Features", click the "Turn Windows Features on or off". In the dialog, find "Windows Subsystem for Linux".

Installing the Windows Subsystem for Linux


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

Installing a Linux distribution within Windows

Once the Windows Subsystem for Linux is installed, it is time to select a variant of Linux; also known as a distribution.

With the Windows Creators Update, this system was expanded to not only support Ubuntu, but to now feature multiple different flavors. At time of this post, Ubuntu, OpenSuse and Suse Linux Enterprise Server is available.

Installing Ubuntu

Open the Windows Store, search for Ubuntu and hit "Get" or click the following link Ubuntu on the Windows store

Ubuntu on the Windows store

Initial configuration

First time Ubuntu is launched, it needs additional configuration for the subsystem, to configure your username, password and initialize the folder structure.

Ubuntu first-run-experience

After succesfully installing Ubuntu and configuring the user account, you should run apt-get upgrade to upgrade all packages which have been updated since the distribution was put on the Windows store.

Other Linux distributions


Suse Linux Enterprise Server

Installing X-Server

As mentioned above, the X architecture allows us to display applications on a remote system. To utilize this, we need a Windows implementation of the X server; multiple exists but I have chosen to go with Xming X Server for Windows

Wiring it up with Linux

X on Linux uses the "Display" environment variable to know where to route any visual items. To quickly test the setup, we can set the environment variable to hit locally

export DISPLAY=:0

Installing an application with a graphical user interface

apt-get install x11-apps

xeyes running graphically in Windows, under Linux


Since you are running Bash locally, your setup will most likely always want to set Display to hit the local x-server. To set the environment variable upon login, modify ~/home/.bashrc with your favorite text editor. If you don't have any, I would recommend nano, as unlike vi, people tend to figure out to exit the application once edits are done.

nano ~/.bashrc

Add the following content to the bottom of the file

if [[ -z "$DISPLAY" ]]; then
    export DISPLAY=:0

restart your bash instance and try to execute any graphical application; such as xeyes.

Help - I forgot my root password!

Running Linux as part of your Windows installation, has it's bennefits - including the ability to reset the root password if you forget it.

User Accounts and Permissions (MSDN)


Add comment