If you want to connect with Remote Desktop to your Ubuntu 18.04 Server, a good way to do so is by using XRDP. If you are like me and run a server with very little RAM you also want to use a Desktop Environment that uses as little memory as possible. LXDE is a very lightweight Desktop Environment, so I will be using that one.
Install required packages
First of all update the package lists with this command
sudo apt update
Then install LXDE
sudo apt install lxde
Then install XRDP
sudo apt install xrdp
Configure XRDP to use LXDE
Open up /etc/xrdp/startwm.sh. I use the nano text editor here
sudo nano /etc/xrdp/startwm.sh
Then add this all the way at the end of the file
lxsession -s LXDE -e LXDE
Disable GUI on boot
If you run a headless server you might want to disable booting into the graphical login screen, to make sure it does not use any extra memory. You can disable the GUI on boot this with this command.
sudo systemctl set-default multi-user.target
And use this command to enable it again if you want to.
sudo systemctl set-default graphical.target
Connect with RDP
Open up Windows Remote Desktop Connection and enter the address of the computer you’re trying to connect to.
Connect and a screen will show where you need to enter your login credentials. Select Xorg from the list and enter your username and password, press OK and you should be seeing the LXDE desktop environment.