Step One: Install and Enable XRDP

To install xdrp on CentOS, first, you need to install the EPEL repository on your system.

[root@centos-vm ~]# yum install -y epel-release
[root@centos-vm ~]# rpm -Uvh

After installing the repository, you can confirm that it is available by running the command below.

[root@centos-vm ~]# yum repolist

Next, install xrdp and tigervnc-server.

[root@centos-vm ~]# yum -y install xrdp tigervnc-server

After that, enable and start the xrdp service.

[root@centos-vm ~]# systemctl enable xrdp
[root@centos-vm ~]# systemctl start xrdp

Next, make sure that the xrdp service is listening on port 3389, by running the netstat command.

[root@centos-vm ~]# netstat -tulpen | grep xrdp

Step Two: Modify the Firewalld Configuration

To allow connections over the RDP, add the rdp port to the systems’ firewalld configuration permanently.

[root@centos-vm ~]# firewall-cmd --permanent --add-port=3389/tcp

Next, reload your firewalld configuration.

[root@centos-vm ~]# firewall-cmd --reload

Step Three: Configure SELinux

Next, configure SELinux for your CentOS system.

[root@centos-vm ~]# chcon --type=bin_t /usr/sbin/xrdp
[root@centos-vm ~]# chcon --type=bin_t /usr/sbin/xrdp-sesman

Next, you can test connectivity to your CentOS system via xrdp using the Remote desktop connection console.

Finally, you will be shown an xrdp login console.