HOW TO REMOTE DESKTOP FROM WINDOWS TO CENTOS SERVER
Enjoying this content? Subscribe to the Channel!
Master RDP: How to Remote Desktop from Windows to CentOS 9 (The XRDP Guide)
Hi everyone, and welcome back to Darren’s Tech Tutorials! If you’ve ever managed a Linux server, you know how convenient it is to have a graphical remote desktop connection, especially when you’re used to the seamless experience of Windows RDP.
Today, we’re going to make that happen. This guide will walk you through the super simple process of installing and configuring XRDP on your CentOS 9 machine, allowing you to connect directly from Windows. While we are focusing on CentOS 9, these steps are typically applicable to many modern RHEL-based distributions like Fedora and other CentOS/Red Hat versions.
Let’s dive in and get your CentOS system ready for remote access!
Step 1: Install the XRDP Package
The XRDP package is what enables the Remote Desktop Protocol services on your CentOS machine. Since XRDP is usually not in the default CentOS repositories, we need to access the EPEL (Extra Packages for Enterprise Linux) repository to pull it down successfully.
Open your terminal on the CentOS server and run the following command to install XRDP:
sudo dnf --enablerepo=epel -y install xrdp
Type in your administrative password when prompted. The installation process will download the necessary dependencies and configure the basic files. Once this is complete, we are ready for the next step.
Step 2: Enable and Start the XRDP Service
After the installation is finished, we need to ensure that the XRDP service is not only running now but is also configured to start automatically every time your server boots up.
Use the systemctl command to enable and immediately start the service:
sudo systemctl enable xrdp --now
You should receive no output if the command is successful, meaning the service is now running in the background and ready to accept connections.
Step 3: Configure the Firewall (Allow Port 3389)
CentOS 9 uses Firewalld by default, which is a fantastic security measure, but it blocks all incoming traffic unless explicitly told otherwise. The RDP protocol uses TCP port 3389. We need to open this port to allow your Windows machine to connect.
First, add the port to the active firewall rules:
sudo firewall-cmd --add-port=3389/tcp
You should see the response success.
Next, and this is crucial, we must make this rule permanent. Runtime rules are lost upon reboot, so run this command to save the configuration:
sudo firewall-cmd --runtime-to-permanent
Once again, you should see success. Your firewall is now configured and ready to go!
Step 4: Find Your IP Address and Prepare for Connection
Before you switch over to your Windows PC, you need two pieces of information: the IP address of your CentOS server and an important preparation step.
Getting the Server IP
Use the ip a or ifconfig command to find your server’s local IP address. Look for the address next to inet under your main network interface (e.g., eth0 or ensXX).
ifconfig
Example IP address format: 192.168.1.150
The Critical Log Out Step
This is the number one troubleshooting step! For XRDP to work correctly, you must log out of the graphical console on the CentOS machine itself before attempting to connect via RDP. If you stay logged in locally, the remote connection will often fail.
Make sure you are fully logged out of the CentOS GUI session.
Step 5: Connect from Your Windows PC
Now that your CentOS server is configured and logged out, switch over to your Windows computer.
- Open the Remote Desktop Connection Client: Press the Windows Key and type “Remote Desktop Connection” (or run
mstsc.exe). - Enter the IP: Paste or type the IP address of your CentOS server (e.g.,
192.168.1.150) into the “Computer” field and click Connect. - Accept the Certificate: You may be prompted with a security certificate warning; click Yes to proceed.
- Log In: The XRDP login screen will appear. Enter your CentOS username (e.g.,
darren) and password. - Success! You will now see your CentOS desktop environment, fully controllable from your Windows machine via RDP.
Summary and Next Steps
That’s all there is to it! In just five simple steps, you have transformed your CentOS server into a fully remote-accessible machine using the familiar RDP protocol thanks to the XRDP package.
Remember these key takeaways:
- XRDP requires the EPEL repository.
- The service needs to be enabled and running.
- Firewalld must explicitly allow port 3389/tcp permanently.
- You must log out of the local console before connecting remotely!
If you found this guide helpful and are enjoying these straightforward tutorials, please consider supporting the channel by hitting that Like button, Subscribing for more tech deep dives, and leaving a comment below if you run into any snags—I’m always happy to help!
Happy remoting!