frame

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In Register

[CentOS 7/AlmaLinux 8] How to install XRDP on CentOS 7/AlmaLinux 8

MichailMichail Moderator
edited February 15 in Linux Applications

Introduction

Xrdp is a free application that allows you to connect to a Linux server from Windows machines over RDP protocol.

In this guide, you will learn how to enable xrdp on RedHat based distributions (CentOS 7 and AlmaLinux 8).

1. Import GPG key repository (on AlmaLinux 8)

This step is for AlmaLinux 8 only. Skip this step if you are installing xrdp on CentOS 7.

Run the following command to install GPG key repository on AlmaLinux 8:

rpm --import https://repo.almalinux.org/almalinux/RPM-GPG-KEY-AlmaLinux

2. Updating the packages

Before installing the xrdp, make sure your software is updated:

yum update

3. Installing the EPEL Repository

The EPEL repository allows you to install frequently used software. To enable it, run the following command:

yum install epel-release

4. Install Xrdp

To install xrdp, run the following command:

yum -y install xrdp tigervnc-server

5. Enable Xrdp

To enable xrdp, run this command:

systemctl enable xrdp

This command enables xrdp automatically every time the server starts.

After you enabled xrdp, make sure to restart it:

systemctl restart xrdp

6. Install GUI

The graphical interface required to log in to the server when you connect over the xrdp. In this example, we will install Xfce.

To install Xfce, run this command:

yum groups -y install "Xfce"

The installation will take some time.

On CentOS 7, you will also need to create the Xclients file, which is required to start the desktop environment (you can skip steps for the Xclients file on AlmaLinux 8):

vi ~/.Xclients

Then copy and paste the following content into that file:

 #!/bin/bash
 XFCE="$(which xfce4-session 2>/dev/null)"
 exec "$XFCE"

Save the file and exit (pres "Esc", then type :wq and click "Enter").

Now you need to make the file executable:

chmod +x .Xclients

Finally, restart the xrdp to enable changes:

service xrdp restart

7. Enable RDP port

Now you need to open port 3389 (the default RDP port) in the firewall tool that you use.

To enable RDP port in iptables, run the following command:

iptables -I INPUT -p tcp -m tcp --dport 3389 -j ACCEPT

After that save the changes. On CentOS 7 run this command:

service iptables save

On AlmaLinux 8 run the following command:

iptables-save

If you use firewalld, to open port 3389 use this command:

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

After that, reload the firewall:

firewall-cmd --reload

8. Check Xrdp

To make sure the Xrdp is enabled, you can check the status of the service:

systemctl status xrdp.service

Log-in from Windows computer:

To test xrdp, try connecting to your VPS from a Windows computer using the Remote Desktop application. Open the app and enter the following details:

Computer: Your_server_IP
Username: root

Then click "Connect" and you will see the default xrdp login page, where you need to enter password of your server:

If the credentials are correct, you will access the server with GUI. In CentOS 7, the first time you connect, you will be prompted to select setup. We recommend that you select the default configuration.

Log-in from Linux:

To connect from Linux, you can use RDP tools like "rdesktop":

rdesktop -u root -p PASSWORD -g 1024x768 YOUR_SERVER_IP

Change the "PASSWORD" and "YOUR_SERVER_IP" to ones that match your server.

You can always change the resolution by updating the "-g 1024x768" parameter.

Please note: the first time you connect, the desktop environment will take a little longer to load than usual. This is normal behavior.

Sign In or Register to comment.

Learn how to install a web and database server, email, FTP client or other applications. Discover and share information on server security or optimization recommendations.
Feel free to join our constantly expanding community, participate in discussions, strengthen your knowledge on Linux and Windows server management!
© 2013 - 2024 Time4VPS. All rights reserved.

Get In Touch