Alternative way to set up WSL Graphic Interface


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):

  1. Update and Upgrade
    sudo apt update && sudo apt upgrade
    
  2. Install Xorg
    sudo apt install xorg
    
  3. Install Xfce4
    sudo apt install xfce4
    
  4. Install Xrdp
    sudo apt install xrdp
    
  5. Set up port for Xrdp
    sudo sed -i 's/port=3389/port=3390/g' /etc/xrdp/xrdp.ini
    
  6. Write Xfce4-session into Xsession
    sudo echo xfce4-session >~/.xsession
    
  7. 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