A Linux VPS is a powerful tool, but for those unfamiliar with navigating Linux with only a terminal, using a Remote Desktop Protocol (RDP) is a great way to visualize any operating system in a more familiar Desktop Environment.
There are many Linux Desktop Environments to choose from, this guide will detail how to install the Desktop XFCE via xRDP software on Linux OS.
There are four steps to set up xrdp:
- Install xrdp and desktop environment
- Instruct xrdp to start a session of the chosen desktop environment
- Allow xrdp in firewall rules
- Start the xrdp service
The following steps assume that you are logged in as root.
Step 1: How to Install xRDP and XFCE
apt-get update && apt-get install xrdp xfce4
Note: If your system has limited resources, LXDE is a recommended alternative to XFCE for Ubuntu systems - this environment is unfortunately not available in the official CentOS repos. For CentOS installation:
You will need to install epel-release before installing xrdp:
yum update && yum install epel-release
Now install xrdp:
yum install xrdp
For installing the Desktop Environment:
yum groupinstall xfce
Step 2: Setting Linux Desktop Environment
In this step you will define which desktop environment is used with xrdp.
echo "xfce4-session” > ~/.xsession
echo "xfce4-session" > ~./Xclients
Step 3: Configuring Firewall Rules for xRDP
ufw allow 3389
MAKE SURE YOU HAVE ALSO ALLOWED SSH BEFORE RUNNING THE FOLLOWING COMMAND!!! Or you will lose your connection to the server.
The zone setting below is an example, you may need to set a different zone depending on your firewall setup.
firewall-cmd --zone=public --add-port=3389/tcp --permanent
Step 4: Enabling xRDP service
Both Operating Systems:
systemctl enable xrdp && systemctl start xrdp
You now have a visual user interface for your VPS!
To access it from windows, simply search for the "Remote Desktop Connection" program and enter the IP address of your server to get connected.
From Mac, Microsoft Remote Desktop is a free third-party tool that works as needed.