How to Enable Remote Desktop on CentOS 8.x

Remote desktop access to CentOS Linux VPS is super easy using Windows remote desktop connection. Let’s head to enable remote desktop on CentOS Linux by installing XRDP on CentOS 8.x VPS and configure it for GUI remote connection.

The XRDP is an open-source implementation of the Microsoft Remote Desktop Protocol (RDP) that allows you to control a remote system graphically. With RDP, you can log in to the remote machine and create a real desktop session the same as if you had logged in to a local system.

The article explains the process of install and configure XRDP on CentOS VPS and connect it from Windows 10 remote desktop.

If you like to have remote access to CentOS VPS using SSH, head to configure SSH on CentOS Server article.

Installing Desktop Environment on CentOS

A Linux server usually comes without GUI, and the desktop environment not installed by default. If the CentOS VPS you have to connect to doesn’t have GUI, the first step is to install the desktop environment to have access a graphical interface remote desktop.

The Gnome is the default desktop environment in CentOS 8. To install Gnome on your remote machine, run the following command.

If your Linux machine has the desktop environment already installed, do not execute the command. Just update for latest security packages.

sudo yum groupinstall "Server with GUI"
Install CentOS Server with GUI on CentOS VPS

It will take time and depending on your system speed and download speed to complete the installation of the Gnome packages and dependencies.

Install and Enable Remote Desktop on CentOS

The XRDP is available in the EPEL software repository. If EPEL doesn’t enable on your system, try to allow it by typing the following command.

sudo yum install epel-release

You might be faced with the below error. In this case, simply enable the epel package on your system.

[root@enlinux ~]# yum install epel-release
Updating Subscription Management repositories.
Last metadata expiration check: 0:14:11 ago on Mon 24 Aug 2020 10:27:24 AEST.
No match for argument: epel-release
Error: Unable to find a match: epel-release
[root@enlinux ~]#

To enable epel-release on Red Hat 8.x, head up to this article: How To Install EPEL Repo on an RHEL 8.x

Now the system is ready for installing the XRDP package which included in the standard CentOS 8 repositories. Type the following command to install XRDP.

sudo yum install xrdp -y 
Install XRDP on CentOS VPS – CentOS Remote Desktop

When the installation process has done, start the XRDP service and enable it with the following commands.

sudo systemctl enable xrdp
sudo systemctl start xrdp

Enable Remote Desktop on CentOS 8.x VPS

Type the following command to verify that XRDP is enabled and running on your machine.

sudo systemctl status xrdp

Configuring XRDP on CentOS Linux

You can find the XRPD configuration files in the/etc/xrdpdirectory. For regular XRDP connections, you only need to set XRDP to use Gnome. To edit it the file, open the following file in your text editor and past the (exec gnome-session) at the end of the text.

sudo nano /etc/xrdp/xrdp.ini

Now just add the following line at the end of the file. Check the screenshot of xrdp.ini file to make sure you are doing as it should be.

exec gnome-session
Enable Remote Desktop on CentOS VPS

When you have done, just save the file and restart the XRDP service with the following command.

sudo systemctl restart xrdp

Configuring Firewall for Remote Desktop

The default remote desktop port is 3389. So, as usual, the XRDP is listening to 3389 port on all interfaces. To make the machine Firewall aware that we are using the remote desktop port, we should add the port 3389 to the Firewall and allow it.

The following command will allow the port 3389 to accept incoming network traffic from anywhere.

Allowing access from anywhere is highly discouraged for security reasons.

sudo firewall-cmd --add-port=3389/tcp --permanent sudo firewall-cmd --reload
Allow Remote Desktop port 3389 – CentOS Remote Desktop

All good. It’s enough to allow remote desktop in the Linux Firewall. But to allow only for a specific network or ranges of IP addresses you need to type the following command. It’s a good practice for the production environment.

sudo firewall-cmd --new-zone=xrdp --permanent sudo firewall-cmd --zone=xrdp --add-port=3389/tcp --permanent sudo firewall-cmd --zone=xrdp --add-source=192.168.1.0/24 --permanent sudo firewall-cmd --reload

Verifying Remote Desktop XRDP

The final stage, verify the XRDP server to make sure it is up and running and listening to remote desktop port 3389. The netstat command helps to check it.

netstat –atnp | grep 3389

Connect CentOS Server Using Remote Desktop

To run remote desktop connection in Windows 10, press (Windows + R) key to open the Run. Then type (mstsc) and press enter.

Open Windows Remote Desktop Connection

Type your CentOS Linux IP address and try to connect to the XRDP using Windows remote desktop.

Connect to CentOS Linux using Remote Desktop in Windows 10

Accept the remote desktop connection certification prompt and go ahead to login page.

Accept Remote Desktop Connection to Linux.

Type the the CentOS server username and password then connect it.

Linux Remote Desktop Username and Password

The result should be a friendly clean graphical interface of CentOS server like the below screenshot.

Remote Desktop Connection to Linux CentOS 8.x

The final note: The Linux distros are capable of having access graphically using remote desktop protocol software. But the power of terminal and command lines are not in a GUI.

  • centos rdp, centos gui
  • 0 کاربر این را مفید یافتند
آیا این پاسخ به شما کمک کرد؟

مقالات مربوطه

How to access server via Remote Desktop (RDP)?

Remote Desktop Protocol (RDP) is a proprietary protocol developed by Microsoft, which provides a...

How to install Let’s Encrypt on CentOS 7 with Apache?

Today, we will show you, How to install Let’s Encrypt on CentOS 7 with Apache. Let’s Encrypt is a...

Domains are not showing in WHM -> List accounts

We were unable to see any domains listed under WHM -> List Accounts. However, we can see the...

HOW TO INSTALL LITESPEED WEB SERVER IN LINUX SERVER?

Litespeed Cache is useful to increase high performance for your Wordpress Website. Following are...

Remove ONLY_FULL_GROUP_BY in my.cnf file

Remove ONLY_FULL_GROUP_BY in my.cnf file First you need to find my.cnf file location and then...