TroubleChute Logo
WSL

Desktop GUI


Published: Sep 9, 2022
Last Edit: Oct 13, 2022
Ubuntu
764 Words, 3 Minutes.

Watch the video:


Timestamps:
0:00 - Explanation
0:44 - Install WSL
1:17 - Set WSL version 2
2:04 - Install 
3:30 - Fix DNS
4:30 - Installing Desktop environment
5:20 - Set up RDP
5:56 - Connect using Windows Remote Desktop
6:28 - Using other desktop environments

Why and why not

A GUI is the simplest way of interacting with a computer. If using a GUI is necessary for people to test out Linux, then it’s essential. You don’t need one of these to use GUI programs under WSL. Some programs just launch, and you can see them; others require a few steps. This is for a full-blown desktop environment, much like you’d get if you installed Ubuntu or any other distro under a virtual machine/hypervisor like Hyper-V or VMWare.

You can do this, but you should become more reliant on the command line rather than a GUI - especially if you’re looking to work with Linux servers in the future. The command line will become a second home.

Set up Windows and a Linux distro

I’ll be using Ubuntu as it’s the most popular and most widely supported OS for the most part. There are more tutorials and guides for getting out of sticky situations here than in any other distro.

To start, you need to ensure Windows can run WSL.

You will need to make sure that both Windows Subsystem for Linux and Virtual Machine Platform are ticked. Hit OK and restart your computer if necessary.

Now, we need to set the WSL environment to version 2.

Now we can install a Linux distro. I will use Ubuntu.

While installing, you will need to set up an account and the rest. Click through doing whatever is nessecary.

Preparing Ubuntu

Now, update Ubuntu.

If you run into an issue where nothing happens or time out, run sudo nano /etc/resolv.conf and change the nameserver x.x.x.x to nameserver 8.8.8.8 for Google DNS, or nameserver 1.1.1.1 for Cloudflare’s DNS.

Verify that everything is up-to-date with lsb_release -a, or install Neofetch (sudo apt install neofetch) and run neofetch.

Set up the Desktop Environment

Now, for the exciting bit. We’ll set up a desktop environment and use a remote access tool to interact with it. Remote Desktop is included with Windows. If you can install WSL you already meet the minimum version requirements (I think Windows Pro or higher is needed).

We’ll use XFCE4, as it’s the simplest.

Then, run the following:

To finish setting up the RDP access:

Now, open Remote Desktop on your Windows host machine, and connect to localhost:3390.

Article bonus info

While you may be tempted, like I was, to install the official Ubuntu desktop environment, Gnome… Just don’t. Save yourself hours of time.

While it’s simple enough to set up, getting it to work is a much longer process. Gnome doesn’t work well with WSL, or at least the Ubuntu flavor.

If you want to attempt, here’s as far as I know. If you get it working, please share it with me so I can cover it!

Install the required dependencies: sudo apt-get install xorg xterm gdm3 menu gksu synaptic --no-install-recommends

Hypothetically you would be able to run either of the following:

Then configure the desktop environment

And that’s it. Enjoy your working desktop environment, and make the best of it. You will likely get a better experience installing a full-blown VM with Linux. However, this is an excellent way of keeping it tightly integrated with Windows.

TCNO TechNobo / TroubleChute © Wesley Pyburn (TechNobo / TroubleChute)