How to Set Up Remote Desktop Protocol on CentOS 7


Remote Desktop Protocol (RDP) allows you to access and control a remote desktop or server from a different location. In this guide, we'll walk you through the steps to set up RDP on CentOS 7, enabling you to remotely access your CentOS machine's graphical user interface (GUI) using a compatible RDP client.

Prerequisites: Before you begin, make sure you have:

1. A CentOS 7 server instance.

2. Root access or a user account with sudo privileges.

3. A stable internet connection.

Step 1: Install Xfce Desktop Environment

To provide a graphical interface for RDP, we'll install the lightweight Xfce desktop environment.

sudo yum install epel-release
sudo yum groupinstall "Xfce" -y

Step 2: Install XRDP

XRDP is an open-source implementation of the Microsoft RDP (Remote Desktop Protocol) server.

sudo yum install xrdp -y

Step 3: Start XRDP Service

Once XRDP is installed, start the XRDP service and enable it to start automatically at boot time :

sudo systemctl start xrdp
sudo systemctl enable xrdp

Step 4: Configure Firewall

If your CentOS server is running a firewall (e.g., firewalld), you'll need to allow RDP traffic through the firewall. Execute the following commands to open the necessary port :

sudo firewall-cmd --add-port=3389/tcp --permanent
sudo firewall-cmd --reload

Step 5: Connect to CentOS via RDP
On your local machine, use an RDP client to connect to your CentOS server. You can use popular RDP clients like Remote Desktop Connection (Windows), Remmina (Linux), or Microsoft Remote Desktop (Mac).

Enter the IP address or hostname of your CentOS server, and when prompted, provide your username and password to log in.

Step 6: Optional - Configure XRDP to Use Xfce Session

By default, XRDP uses the GNOME desktop environment. If you prefer to use Xfce, create a configuration file to set the default session.

echo xfce4-session > ~/.xsession
sudo systemctl restart xrdp

Conclusion :

You have successfully set up Remote Desktop Protocol (RDP) on your CentOS 7 server. Now you can remotely access your CentOS machine's desktop environment using an RDP client from any compatible device. Feel free to explore further customization options and additional security measures as needed. If you encounter any issues, refer to the CentOS documentation or seek assistance from the community.