XRDP is an open-source implementation (Apache License 2.0) of the RDP (Microsoft Remote Desktop Protocol) for Linux servers. Thanks to this adaptation, you can connect to Linux servers using a Windows remote desktop client to access the server's GUI. Therefore, you need to have a graphical environment installed beforehand. We recommend using XFCE, LightDM, or KDE Plasma as they are lighter graphically compared to GNOME or Unity.
The XRDP analog uses TCP and UDP protocols for connection, but this implementation uses only TCP. Therefore, it is important to reduce packet size. Optimization is essential for a good remote desktop experience, and we do not recommend using the sound module for this reason.
By default, in Linux images, no graphical environment is included except for the exception of the Preinstalled Ubuntu Desktop Image with XFCE and XRDP preinstalled, which you can use directly without any prior action (How to Access the Preinstalled Ubuntu Desktop Image via Remote Desktop).
But if you prefer to use your favorite distribution or another graphical environment, in this article, we will explain how to install XRDP on your favorite distro among the available Linux images. You can use this article to install it on Alma/Rocky Linux and from CentOS 8, but remember to have a minimum of 10 GB of disk space.
Installation of Interface and XRDP
First, enable the PowerTools repository for RHEL:
# dnf -y install epel-release && dnf config-manager --set-enabled powertools
Then you can install the GUI (XFCE):
# dnf -y group install "xfce" && dnf -y install lightdm
Also, check or activate Lightdm:
# systemctl enable lightdm
First, enable the PowerTools repository for RHEL:
# dnf -y install epel-release && dnf config-manager --set-enabled powertools
Then you can install GUI (GNOME):
# dnf -y group install "Server with GUI"
First, enable the PowerTools repository for RHEL:
# dnf -y install epel-release && dnf config-manager --set-enabled powertools
Then you can install GUI (Plasma):
# dnf -y group install "KDE Plasma Workspaces"
Once the interface is installed, install XRDP:
# dnf -y install xrdp xorgxrdp
You will need to make some changes to the XRDP configuration file, edit it with nano (for example):
# yum install nano -y && nano /etc/xrdp/xrdp.ini
You need to uncomment the following lines (at the end):
[Xorg]
name=Xorg
lib=libxup.so
username=ask
password=ask
ip=127.0.0.1
port=-1
code=20
Improving the XRDP Experience (Optional)
XRDP's RDP implementation is not as optimized as in Windows and uses only TCP packets. For this reason, you may experience latency when using it, but you can improve the experience by reducing color quality and other options.
One configuration to enhance performance is to reduce the maximum bits per pixel:
# sed -i 's/max_bpp=32/max_bpp=16/g' /etc/xrdp/xrdp.ini
Also, configure the maximum bits per pixel for the XRDP server:
# sed -i 's/xserverbpp=24/xserverbpp=16/g' /etc/xrdp/xrdp.ini
Enable Xorg auto-start:
# sed -i 's/autorun=/autorun=Xorg/g' /etc/xrdp/xrdp.ini
Reduce encryption:
# sed -i 's/crypt_level=high/crypt_level=low/g' /etc/xrdp/xrdp.ini
In the same configuration file, you can add the "use_compression" variable after "max_bpp" with the following value:
use_compression=yes
This way, the quality will be 16 bits per pixel even if 32 bits of color are specified on the RDP client. It will improve the connection's fluidity, and the color change will not be so significant. It will also use low encryption and compression to optimize each packet.
Creating a User for Remote Desktop
Access with the root user is disabled by default for security reasons. Therefore, you can create an additional user and assign a password:
# adduser xrdpuser && passwd xrdpuser
You can also give sudo permissions to the created user:
# usermod -aG wheel xrdpuser
Final Steps and Service Verification
Next, you should enable the service and restart it to apply the configuration changes:
# systemctl enable xrdp && systemctl restart xrdp && systemctl status xrdp
You can also check that the service is listening on the default port:
# yum install net-tools -y && netstat -tulpn | grep 3389
You should get the following result in netstat:
tcp LISTEN 0 2 *:3389 *:* users:(("xrdp",pid=51341,fd=11))
Connecting via Remote Desktop
Now that you have XRDP installed, you can log in with the user you created from any remote desktop client:
Switching Modes in Emergency Console (Optional)
To use the graphical interface in the emergency console:
# systemctl set-default graphical.target
To switch the console to text mode:
# systemctl set-default multi-user.target
We hope this article has been helpful. If you have any questions about this or any other Clouding server-related issue, please feel free to contact us at soporte@clouding.io. We are here to assist you! 😉