Install Xrdp on CentOS 7

Installing Xrdp on a CentOS 7 Linux guest in VirtualBox will allow Remote Desktop connections from Windows. These instructions are for CentOS 7 Linux. Click here for the Video tutorial on YouTube.

Note: This Centos 7 VM is running in VirtualBox. No additional packages or services have been added. It is a bare bones Centos 7 VM with only the following.

  • Minimal Centos 7 installation from .iso.
  • yum group install “Server with GUI”

Ensure Centos 7 VM and Windows are on same Network

If you are running VirtualBox on a Windows host and only have one network adapter, chances are your Windows host will not be able to communicate with your Centos 7 VM.

If you do not have an network interface that is on the same network with an IP address within the same subnet as Windows, follow the instructions below.

  1. In VirtualBox, shutdown the Centos 7 VM
  2. In VirtualBox with the VM selected, select Settings > Network
  3. By default, Adapter 1 may be the only interface running. Select the Adapter 2 tab.
  4. Check the box next to Enable Network Adapter.
  5. Select Bridged Adapter as the option for the Attached to: option. No other options needed, select Ok.
VirtualBox Centos 7 bridged network adapter xrdp
Enable the second network adapter and attached it to Bridged adapter
  1. Start the Centos 7 VM back up. You should now have an interface active on the same subnet as your Windows machine.
    1. This is where Centos 7 vs Centos 8 are different. The second network adapter was not automatically active in Centos 8. nmcli was needed to fully connect the bridged adapter.

Add the EPEL Yum Repository

  1. Xrdp is available in the EPEL repository. The easiest solution is to add the epel-repository so that we may install xrdp via yum install.
  2. Add the EPEL repository to your Centos 7 VM by running
sudo yum install epel-release
epel-release centos 7 install virtualbox vbox repository xrdp
Yum install epel-release

With the EPEL repository added, we don’t need to manually download and install xrdp.

Yum Install Xrdp on Centos 7

  1. Install xrdp with Yum or dnf for Centos 8
sudo yum install xrdp
  1. Ensure xrdp starts every time Centos 8 starts:
sudo systemctl enable xrdp.
  1. Start xrdp service on Centos 8
sudo systemctl start xrdp

Xrdp is now installed on Centos 7 and ready to go. However, we must open port 3389 of the firewall to allow connections to the xrdp service.

Open Port 3389 For Xrdp Connections from Remote Desktop

  1. In Centos 7, open port 3389 for xrdp connections with
sudo firewall-cmd --add-port=3389/tcp --permanent.
  1. IMPORTANT: Restart the firewall service.
sudo firewall-cmd --reload
  1. You can verify firewall port 3389 is open by running the following netstat command
[protech@localhost ~]$ sudo netstat -an |grep 3389
tcp        0      0  *               LISTEN     

With verification that firewall port 3389 is open, remote desktop connections from Windows will now be able to communicate with the Xrdp service on Centos 7. Almost done!

Open a Remote Desktop Connection to Centos 7 xrdp

  1. Open Remote Desktop
  2. Enter the IP address of the Bridged Adapter IP (enp0s8) on the Centos 7 VM.
windows remote desktop connection bridged adapter centos 7 vbox virtualbox
Enter the IP address of the enp0s8 interface on the Centos 7 VM
  1. A warning will appear with the message “The identity of the remote computer cannot be verified. Do you want to continue anyway?“.
    1. The reason states a name mismatch between the computer’s name (the IP address), and the certificate (XRDP). In addition, the certificate is not trusted. As this is a basic configuration of Xrdp for Centos 7, this is to be expected, and we can accept.
  2. Before selecting yes, check the box next to “Don’t ask me again for connections to this computer“.
vbox remote desktop connection xrdp ip address certificate error
Check the box to connect despite certificate errors
  1. An Xrdp connection windows will appear with with a session type, and username and password fields. Select Xvnc as the Session type, and enter credentials for a Centos 7 account.
vbox virtual box remote desktop connection xrdp centos7 centos session
Use Xvnc as the Session. Enter Centos 7 username and password to start Xrdp session!
  1. A new Remote Desktop window will appear with the desktop for the Centos 7 user, completing the connection to Xrdp.
Centos7 Xrdp connection resolution maximum virtualbox vbox windows connection
Success! Remote Desktop connection to Xrdp on Centos 7.

Leave a Reply

Your email address will not be published. Required fields are marked *