How to run graphical Linux applications on Bash on Ubuntu on Windows 10

Install Bash on Ubuntu on Windows

  1. Open a command prompt as your normal user
  2. Run bash
    A screenshot of the Ubuntu license prompt

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:

  1. Install a X server for Windows
  2. 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.

  1. Download and run the latest installer
  2. Locate the VcXsrv shortcut in the Start Menu
    1. Right click on it
    2. Select More>Open file location
    3. Copy the VcXsrv shortcut file
  3. Paste the shortcut in %appdata%\Microsoft\Windows\Start Menu\Programs\Startup
  4. 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

  1. In bash run:
    echo "export DISPLAY=localhost:0.0" >> ~/.bashrc
  2. To have the configuration changes take effect, restart bash, or run:
    . ~/.bashrc

Test a graphical application

  1. Install x11-apps
    sudo apt-get install x11-apps
  2. 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 Bash on Ubuntu on Windows 10

One Reply to “How to run graphical Linux applications on Bash on Ubuntu on Windows 10”

  1. Pingback: How to set up working X11 forwarding on WSL2 – .: Dr. Agus M Soleh, S.Si, MT :.

Leave a Reply