This article is contributed. See the original author and article here.
In this post I will demonstrate how to run Linux GUI (Graphical User Interface) applications on Windows Desktop platform.
For now, it is necessary to install a third-party App to run the GUI Apps, but Microsoft announced on //build 2020 that they will release soon an improvement that will not require any third-party component to run Linux GUI Apps on Windows Desktop.
Pre-requirements:
- Windows 10
- WSL
If you want to know how to install WSL on Windows 10, please check the following post:
Using WSL2 in a Docker Linux container on Windows to run a Minecraft Java Server
Installing the X Server
The X server is a provider of graphics resources and keyboard/mouse events. I am using the VcXsrv Windows X Server that is open-source and is frequently update.
The first step is to install the third-part display manager called VcXsrv Windows X Server available at:
https://sourceforge.net/projects/vcxsrv/
During setup is important to disable the access control to avoid the permission denied error when trying to run a GUI application:
To warranty that the “Disable access control” will be always checked, save the configuration and always launch VcXsrv using the configuration file (config.xlaunch):
The next step is to set the DISPLAY environment variable on Linux to use the Windows host’s IP address as WSL2 and the Windows host are not in the same network device. It is necessary to run the following bash command to load the correct IP address on launch:
export DISPLAY="`grep nameserver /etc/resolv.conf | sed 's/nameserver //'`:0"
Running the following command, it is possible to see that the $DISPLAY environment variable now has the Windows Host’s IP set:
Echo $DISPLAY
To avoid having to run that command every time that WSL is launched, you can include the command at the end of the /etc/bash.bashrc file:
Done! Now you can run the Linux GUI Apps on Windows desktop.
Let’s try this out!
Follows some Apps that you can use to test:
Install Chromium Dev :
sudo add-apt-repository ppa:saiarcot895/chromium-dev
sudo apt-get update
sudo apt-get install chromium-browser
Install GEDIT:
sudo apt install gedit
gedit
Install x11-apps:
sudo apt install x11-apps
xeyes
xcalc
Make sure that XLaunch is running and before calling the Linux GUI Apps on Windows Desktop environment.
What about accessing the Linux Desktop Environment via RDP?
The first thing that you need to do is to install a Linux Desktop Environment. I will user Xfce as it is a lightweight one.
Run the following commands to install Xfce:
sudo apt install xfce4
The next step is to install the xrdp that provides a graphical login to remote machines using RDP (Microsoft Remote Desktop Protocol).
sudo apt install xrdp
Type the following command to get the WSL IP address:
ip a
Make sure that xrdp service is running:
Run the Remote Desktop Client (MSTSC) and type the WSL IP address to connect to xfce4:
Done! Now you can access your favorite Linux IDE on WSL.
In this post we see how to run GUI Linux Apps using XServer on Windows Desktop environment and how to access the full WSL Linux desktop environment.
I hope you liked!
Brought to you by Dr. Ware, Microsoft Office 365 Silver Partner, Charleston SC.
it crashes every time i try.
What should i do?
Can you be more specific? What crashes – Windows? WSL? RDP? There are a few moving parts here. I think if you follow the steps carefully, as well as reference the linked articles, you can have a successful installation.