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.
- Install Xrdp on CentOS 8 Linux: Install Xrdp on CentOS 8.
- Install Xrdp on Ubuntu 20 Linux: Remote Desktop from Windows to Ubuntu Xrdp.
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”
Table of Contents
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.
- In VirtualBox, shutdown the Centos 7 VM
- In VirtualBox with the VM selected, select Settings > Network
- By default, Adapter 1 may be the only interface running. Select the Adapter 2 tab.
- Check the box next to Enable Network Adapter.
- Select Bridged Adapter as the option for the Attached to: option. No other options needed, select Ok.
- Start the Centos 7 VM back up. You should now have an interface active on the same subnet as your Windows machine.
- 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.
- This is where Centos 7 vs Centos 8 are different. The second network adapter was not automatically active in Centos 8.
Add the EPEL Yum Repository
- 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
. - Add the EPEL repository to your Centos 7 VM by running
sudo 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
- Install xrdp with Yum or dnf for Centos 8
sudo yum install xrdp
- Ensure xrdp starts every time Centos 8 starts:
sudo systemctl enable xrdp.
- 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
- In Centos 7, open port 3389 for xrdp connections with
sudo firewall-cmd --add-port=3389/tcp --permanent.
- IMPORTANT: Restart the firewall service.
sudo firewall-cmd --reload
- You can verify firewall port 3389 is open by running the following
netstat
command
[protech@localhost ~]$ sudo netstat -an |grep 3389
tcp 0 0 0.0.0.0:3389 0.0.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
- Open Remote Desktop
- Enter the IP address of the Bridged Adapter IP (enp0s8) on the Centos 7 VM.
- A warning will appear with the message “The identity of the remote computer cannot be verified. Do you want to continue anyway?“.
- 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.
- Before selecting yes, check the box next to “Don’t ask me again for connections to this computer“.
- 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.
- A new Remote Desktop window will appear with the desktop for the Centos 7 user, completing the connection to Xrdp.