Skip to content
Home » Run Linux Applications Using Ubuntu GUI on Windows 11 with WSL2

Run Linux Applications Using Ubuntu GUI on Windows 11 with WSL2

Requirements and Dependencies

Before getting started, make sure you have the following:

Step 1: Install a Desktop Environment

The first step is to install a desktop environment on your Ubuntu WSL2 instance. There are many options to choose from, such as GNOME, KDE, Xfce, and more. In this tutorial, we will use Xfce as an example.

To install Xfce, run the following command in your Ubuntu terminal:

sudo apt-get update
sudo apt-get install xfce4 xfce4-goodies

This will install the Xfce desktop environment and some additional plugins.

Step 2: Configure X11 Forwarding

Next, we need to configure X11 forwarding so that the graphical applications can display on your Windows machine.

Open the Ubuntu configuration file using the following command:

nano ~/.bashrc

At the end of the file, add the following lines:

export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}'):0
export LIBGL_ALWAYS_INDIRECT=1

Save and close the file. Then, run the following command to apply the changes:

source ~/.bashrc

Step 3: Start the X Server

Now, start the X Server on your Windows machine. If you are using VcXsrv, open the XLaunch application and select the “Multiple Windows” option. Click “Next” and then “Finish”.

Step 4: Launch the Desktop Environment

Finally, launch the desktop environment from the Ubuntu terminal using the following command:

startxfce4

This will start the Xfce desktop environment on your Windows machine. You can now launch any Ubuntu GUI application from the menu or terminal.

Right click XLaunch in tray and open your Ubuntu application

Key Takeaways

  • Install a desktop environment on your Ubuntu WSL2 instance
  • Configure X11 forwarding in your Ubuntu configuration file
  • Start the X Server on your Windows machine
  • Launch the desktop environment from the Ubuntu terminal

Examples and Tips

  1. Use the GUI version of your favorite text editor, such as gedit or Sublime Text.
  2. Use the GUI version of Git to manage your repositories.
  3. Use the GUI version of Inkscape or GIMP for image editing.
  4. Use the GUI version of Firefox or Chromium for web browsing.
  5. Use the GUI version of Thunderbird for email.

Additional Resources

  • For more information on WSL2, see the Microsoft documentation.
  • For more information on the X Window System, see the X.org documentation.
  • For more information on a specific desktop environment, such as Xfce, see the respective project’s website and documentation.

Leave a Reply

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

8 + twenty =