How to run graphical Linux applications on Bash on Ubuntu on Windows 10
Install Bash on Ubuntu on Windows
After you have accepted the license, the Ubuntu user mode image will be downloaded, and a “Bash on Ubuntu on Windows” shortcut will be added to your Start Menu.
To launch Bash on Ubuntu Windows, either run bash
at a cmd/PowerShell command prompt, or use the Start Menu shortcut.
Graphical Applications
In order to run Linux GUI applications on Bash On Ubuntu on Windows, you must:
- Install a X server for Windows
- Configure bash to tell GUIs to use the local X server
Install VcXsrv
In order to run graphical Linux applications, you’ll need an X server.
VcXsrv is the only fully open source and up-do-date native X server for windows.
- Download and run the latest installer
- Locate the VcXsrv shortcut in the Start Menu
- Right click on it
- Select More>Open file location
- Copy the VcXsrv shortcut file
- Paste the shortcut in
%appdata%\Microsoft\Windows\Start Menu\Programs\Startup
- Launch VcXsrv for the first time
You may receive a prompt to allow it through your firewall. Cancel/deny this request! Otherwise, other computers on your network could access the server.
A X icon will appear in your system tray.
Configure bash to use the local X server
- In bash run:
echo "export DISPLAY=localhost:0.0" >> ~/.bashrc
- To have the configuration changes take effect, restart bash, or run:
. ~/.bashrc
Test a graphical application
- Install
x11-apps
sudo apt-get install x11-apps
- Run
xeyes
A new window will open, containing a pair of eyes that will follow your mouse movements.
Source:
How to run graphical Linux applications on Windows 10 using the Windows Subsystem for Linux (WSL)