Using Graphic interface on WSL2, the most popular way is Xfce4 + VcxSrv. But I would like provide different way with Xrdp + remote desktop from win10.
Following are the steps(assume you have ubuntu installed on WSL):
- Update and Upgrade
sudo apt update && sudo apt upgrade - Install Xorg
sudo apt install xorg - Install Xfce4
sudo apt install xfce4 - Install Xrdp
sudo apt install xrdp - Set up port for Xrdp
sudo sed -i 's/port=3389/port=3390/g' /etc/xrdp/xrdp.ini - Write Xfce4-session into Xsession
sudo echo xfce4-session >~/.xsession - Restart Xrdp service
sudo service xrdp restart
Once above done, then you can go to windows, start “remote desktop connection” and in the dialog box input : “127.0.0.1:3390”, you should see the xfce4 desktop on your screen.
if you want to restart the WSL2 ubuntu, in serices.msc bounce service called: LxssManager
if you want to remove the current ubuntu, run wsl --unregister Ubuntu from windows terminal