If you are looking to configure remote desktop on your Ubuntu server, you’ve found the perfect tutorial!
By default, when you buy a Ubuntu VPS server, you will not get GUI access to server, as these servers only come with command line access over SSH by default. However, with just a few commands you can configure Remote Desktop to access your Ubuntu via a GUI (graphical user interface).
Update your Ubuntu server:
sudo apt-get update -y
Install xrdp Package
sudo apt-get install xrdp -y
Install your preferred remote desktop Display Manager
sudo apt install xfce4 xfce4-goodies xorg dbus-x11 x11-xserver-utils
Once you install xfce, you will be prompted to choose the display manager – go ahead and select “lightdm”:
Some times you might see the package manager will be locked, such as the below screenshot:
To fix this, first identify the process ID of the dpkg package.
ps aux | grep -i dpkg
Then you can kill the process ID accordingly:
sudo kill -9 process _id
Followed by deleting the lock files:
sudo rm /var/lib/dpkg/lock
sudo rm /var/lib/apt/lists/lock
sudo rm /var/cache/apt/archives/lock
Configuration of xfce desktop environment
After installation of display manager and you need to configure it to access via RDP
sudo sed -i.bak ‘/fi/a #xrdp multiple users configuration \n xfce-session \n’ /etc/xrdp/startwm.sh
Start xrdp application and xrdp-ssl cert
sudo systemctl status xrdp
sudo systemctl enable xrdp
sudo systemctl start xrdp
sudo adduser xrdp ssl-cert
sudo ufw allow 3389
By now, we have successfully configured Remote Desktop on Ubuntu Server – you can now access it by entering your server IP address in your Remote Desktop client. It should then prompt a login screen like the below:
Once you’ve connected to your server over Remote Desktop, log in using the same user credentials as you utilized to access SSH.