Ubuntu on Windows 10 with WSL2 and GUI Setup Via Remote Desktop

So you want to Install WSL2 and Setup a graphical user interface (GUI) with Ubuntu 20.04 using WSL 2 on a Windows 10 computer. I learned how to setup WSL2 with a GUI from David Bombals video, and Robin Kretzschmar

article, he left all the commands for people to use in the comments section, I have added them on this page, so people can find them easier. credit goes to David Bombal. I show you step by step on how to get GUI installed and how to connect to the GUI using remote desktop, it’s pretty cool.

WSL commands:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart wsl –set-default-version 2

wsl –set-default-version 2

Ubuntu GUI commands:
sudo apt update && sudo apt -y upgrade
sudo apt-get purge xrdp
sudo apt install -y xrdp
sudo apt install -y xfce4
sudo apt install -y xfce4-goodies

sudo cp /etc/xrdp/xrdp.ini /etc/xrdp/xrdp.ini.bak
sudo sed -i ‘s/3389/3390/g’ /etc/xrdp/xrdp.ini
sudo sed -i ‘s/max_bpp=32/#max_bpp=32\nmax_bpp=128/g’ /etc/xrdp/xrdp.ini
sudo sed -i ‘s/xserverbpp=24/#xserverbpp=24\nxserverbpp=128/g’ /etc/xrdp/xrdp.ini
echo xfce4-session > ~/.xsession

sudo nano /etc/xrdp/startwm.sh
edit these lines to:
# test -x /etc/X11/Xsession && exec /etc/X11/Xsession
# exec /bin/sh /etc/X11/Xsession

add these lines:
# xfce

sudo /etc/init.d/xrdp start

Now go to the search box and type Remote Desktop open
Remote Desktop Connection and type localhost:3390 then login using your Ubuntu username and password, to install Firefox type: sudo apt install firefox

Good Useful links:

Microsoft GUI announcement

Ubuntu WSL2 GUI Install

WSL 2 install

Docker for WSL2

What is WSL?

WSL documentation

WSL 2 Announcement

Updating the WSL 2 Linux kernel

Leave a Reply