Running Linux GUI Applications in Windows

Hi πŸ‘‹,

This is a quick tutorial on how to run Linux graphical interface application in Windows using X Server’s forwarding feature.

The first step is to download and install the VcXsrv Windows X Server on your πŸ’» Windows machine.

Then, start VcXsrv with the following configuration:

Ensure that VcXsrv is not blocked in Windows Firewall, it should be allowed in Public and Private networks.

You may also use more restrictive firewal settings as explained in /wsl-windows-toolbar-launcher#firewall-rules.


The next step is to configure your Linux box.

I’m using Ubuntu in WSL 2.0 and pasting the following code into ~/.zshrc or ~/.bashrc does the trick for me. Feel free to upvote the author on SO.

# X11
HOST_IP=$(host `hostname` | grep -oP '(\s)\d+(\.\d+){3}' | tail -1 | awk '{ print $NF }' | tr -d '\r')
export LIBGL_ALWAYS_INDIRECT=1
export DISPLAY=$HOST_IP:0.0
export NO_AT_BRIDGE=1
export PULSE_SERVER=tcp:$HOST_IP

After that’s done, if VcXsrv is running, you should be able to open Linux GUI apps from your Terminal.

Thanks for reading! 🍺

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.