VcXsrv allows us to use Linux apps with user interface in Windows 10

VcXsrv in Window 10

When Microsoft first introduced its WSL, just under 4 years ago, many users were delighted with the novelty. Among other things, having the Linux terminal on Windows allows us to use many tools. But this kind of "virtual machine" has a little problem: actually, and explaining it quickly and badly, it is not connected to any output device, so we cannot run applications with GUI. Or not officially, because VcXsrv if he is going to allow us.

VcXsrv is a xorg-based Windows X server. This small application will allow us to simulate that we have a monitor connected to our WSL, with which we can run applications with a user interface. Because installing them was already possible, but it showed an error when we tried to launch them. In this article we will show you the steps you have to follow if, for example, you want to install Gedit on Windows 10.

How to run Linux apps with GUI on Windows 10 thanks to VcXsrv

  1. The first thing we have to do is install WSL. In this article from last September you have explained everything you need to do it. IMPORTANT: At the time of writing, there is no need to upgrade to WSL 2; There are some bugs that block Linux apps with GUI from running on Windows 10. They will probably be fixed in the future, but this is not possible now.
  2. Next, we install VcXsrv, available at this link.
  3. During the installation, we will leave everything as default. At the end of the installation, VcXsrv will run in the background and we will be able to access its options from the system tray.
  4. If it shows us the firewall warning, we allow "VcXsrv windows xserver" access.

Allow connection

  1. The next step is to run the tests. In theory, we can install any app and the command will depend on the Linux distribution we have installed. In Ubuntu and derivatives, the command is the usual one (sudo apt install APP). We remember that installing the apps in WSL is a long process, so you will have to be patient.
  2. Once we have the app installed, we will execute the following command:
export DISPLAY=:0
  1. Once the command is executed, we must launch the application. To do this, we have to write your name in the terminal. In the case of "Gedit", we have to write "gedit".

If we want to run several Linux apps at the same time, we have to launch them from the windows terminal. Remember that to do this, before any command we have to enter "wsl" without the quotes. We will have to use the command from step 6 before launching each application.

Problem solving

There are usually not many problems, but the most common is that we are using WSL 2, which we have already explained that currently has some bugs. What we have to do is downgrade (downgrade). We will do it as follows:

  1. We open Windows PowerShell and type the following command to show us what version of WSL we are using:
wsl -l -v
  1. If it only shows us the help options, it is assumed that we are in WSL 1. If information about the version appears and under "VERSION" it shows "2", we have to go down by entering the following command:
wsl --set-version Ubuntu 1
  1. The next step is patience. It may take 20 to 30 minutes (or more), depending on the equipment we are using, to downgrade. Once the process is complete, the Linux GUI applications should run smoothly.

Be careful, there may be problems with multimedia apps

What is explained in this article is for the image. This means that we can run applications like Gedit without problems, but it is not a good idea to install applications like Rythmbox because the sound will not be as expected. Other than that, the apps work quite well, as if they were native. By not depending on an entire graphical environment, the "virtual machine" works much more fluid than others, like any that we install in Virtualbox or in Microsoft's own Hyper-V.

It is not ruled out that in the future things will also improve in terms of sound. In any case, what is explained in this article will serve all those who want to use some Linux tools in Windows that would not be possible otherwise. Which Linux-exclusive app would you like to be able to run on Windows 10?


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   PrunusH said

    Contribution to execute them from WSL 2 without having to downgrade to WSL 1:

    https://github.com/microsoft/WSL/issues/4106

    Greetings,