As many of us know, starting from Windows 10 1803, Microsoft has made Windows subsystem for Linux running in the background even after the console windows are closed.
Definitely this is a gain for those developers who want to have a Linux environment available always, regardless whether the console windows open or not. My requirements towards the same is pretty limited, as I have live Linux systems for almost all my experiments. However, was never less motivated to explore the WSL environments.
Last time I posted a thread about installing and configuring Ubuntu 18.04 WSL and setting up apache, MySQL.
This time we will see how you could enhance your Ubuntu 18.04 WSL with a proper GUI (Desktop environment). I am sure, majority of the Windows users will appreciate a GUI to interact with Linux against the Linux geeks who prefer command line interactions. In addition, few editors like geany or gedit ONLY could be used in a GUI environment.
We will be using Xfce (light weight desktop manager) & XRDP to achieve the GUI requirements on Ubuntu 18.04 WSL
Fire up your Ubuntu 18.04, and update the instance to the latest
sudo apt update && sudo apt upgrade
This could take a while to complete depending upon your internet connection speed
Once the update & upgrade finished, we will install both Xfce & Xrdp in a single session
sudo apt install xfce4 xrdp
The installation should be pretty smooth and within few minutes everything should complete. Not a single attempt from my end failed to install both Xfce or Xrdp
Once the installation is over, we MUST make sure that the XRDP doesn’t use port 3389 which is used by Microsoft RDP (in case if your Windows 10 is already configured for RDP). Hence we will edit the XRDP configuration file with a different port, in our case 3390
sudo vi /etc/xrdp/xrdp.ini
Change the port from 3389 to 3390 & save the file.
Now we will try start the XRDP service
rajesh@rt04:~$ sudo service xrdp start
* Starting Remote Desktop Protocol server [20190509-12:13:49] [DEBUG] Testing if xrdp can listen on 0.0.0.0 port 3390.
[20190509-12:13:49] [DEBUG] Closed socket 6 (AF_INET6 :: port 3390)
[ OK ]
Open Remote Desktop Connection from your Windows Machine & log on!
Supply your WSL username and password. You can use ONE of the existing WSL usernames, in case if your WSL have more than one user.
One of the main issues I found using Xfce4 was few goodies like print screen should be installed by the user prior screenshot capturing could be made (I took screenshots from the remote session & copied them to Windows for this post). This will include adding new keyboard shortcut keys.
We’ll quickly see how to resolve the above said
First install missing “xfce4-screenshooter”
sudo apt install xfce4-screenshooter -y
Once the package installation finished, we will define a new keyboard shortcut that binds “Print Screen” physical button on the keyboard to Xfce4 screenshot shooter package.
Launch Applications -> Settings -> Keyboard
and using the “Add” button, Create a new shortcut. Xfce4 supports different switches to be used with screenshooter package. I’m using the “-f”, for full screen captures.
Be careful when you define the keyboard shortcuts. There is a space between the command and switches, for example
There is a space between xfce4-screenshooter & the switch “-f”. Once after entering the command and pressing OK will ask you to tap the physical keyboard button that you want to bind with the command. Tap “PrtScr” or other button of your choice & that’s all. Your screen capture should work now.
So why one would even need a GUI over WSL. Well, my answer is short. I always dealt with systems those came with GUI. Many business applications could only be installed over a GUI equipped system. Plus, I am not a geek & after hundreds of attempts I cannot deal with a console based editor like VIM. I feel comfortable with geany/gedit than feeling geeky at mind.
Cheers guys, now your WSL have a GUI. Start think about what YOU can’t do with WSL!
2 thoughts on “Windows Subsystem for Linux | WSL | Ubuntu 18.04 with Xfce & Xrdp”
many thanks Rajesh, great tutorial. I made it to, “Supply your WSL username and password. You can use ONE of the existing WSL usernames, in case if your WSL have more than one user.” I supplied the username and password, but then nothing, (just the Remote Desktop Connection). Any advice on how to finish this would be most appreciated.
I know you did everything as they were mentioned with my post. However, I would like to ask few questions. Did you change the port for xrdp as suggested over my post? Finally did you start the xrdp service? Are you trying to access the WSL remote desktop from the local machine or another machine in the network?