Install xrdp on CentOS 7 / RHEL 7

Prerequisites

1. First, install Gnome GUI on CentOS 7 / RHEL 7

2. xrdp is available in EPEL repository, Install and configure EPEL repository

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

Install xrdp on CentOS 7

Use YUM command to install xrdp package on CentOS 7 / RHEL 7

yum -y install xrdp tigervnc-server

Once xrdp is installed, start the xrdp service using the following command

systemctl start xrdp

xrdp should now be listening on 3389. Confirm this by using netstat command

netstat -antup | grep xrdp

Output:

tcp        0      0 0.0.0.0:3389            0.0.0.0:*               LISTEN      1508/xrdp
tcp        0      0 127.0.0.1:3350          0.0.0.0:*               LISTEN      1507/xrdp-sesman

By default, xrdp service won’t start automatically after a system reboot. Run the following command in the terminal to enable the service at system startup

systemctl enable xrdp

Firewall

Configure the firewall to allow RDP connection from external machines. The following command will add the exception for RDP port (3389)

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

SELinux

Configure SELinux

chcon --type=bin_t /usr/sbin/xrdp
chcon --type=bin_t /usr/sbin/xrdp-sesman

Test xrdp Remote Connectivity

Now take RDP from any windows machine using Remote Desktop Connection. Enter the ip address of Linux server in the computer field and then click on connect

You may need to ignore the warning of RDP certificate name mismatch

You would be asked to enter the username and password. You can either use root or any user that you have it on the system. Make sure you use module “Xvnc

If you click ok, you will see the processing. In less than a half minute, you will get a desktop

Enjoy!