How to add a GUI on CentOS 7 and connect to it via xRDP – step by step instructions
In this tutorial we’ll cover the steps to install different Desktop Environments on your remote CentOS 7 machine and the steps to install xRDP on your remote CentOS 7 machine. We’ll also show you how to connect to your Centos 7 machine via Remote Desktop Connection.
xRDP is a a free and open source Remote Desktop Protocol Server that allows other operating systems, other than Windows, to provide a fully functional remote desktop experience. xRDP is fully compatible with rdesktop, FreeRDP and even Microsoft’s Remote Desktop Client.
Prerequisites
- Recommended (but not required): a
sudo user
when proceeding to make any major changes to your system. - A machine running CentOS 7 with recommended (not mandatory) 2GB of RAM.
1. Install the GUI of your choice
- XFCE Desktop
- MATE Desktop
- GNOME 3 Desktop
- KDE Desktop
$ sudo yum install -y epel-release
$ sudo yum groupinstall -y "Xfce"
$ sudo ln -sf /lib/systemd/system/runlevel5.target /etc/systemd/system/default.target
$ sudo reboot
Create ~/.Xclients
$ echo "xfce4-session" > ~/.Xclients
$ chmod a+x ~/.Xclients
$ sudo yum install -y epel-release
$ sudo yum groupinstall -y "MATE Desktop"
$ sudo ln -sf /lib/systemd/system/runlevel5.target /etc/systemd/system/default.target
$ sudo reboot
Create ~/.Xclients
$ echo "mate-session" > ~/.Xclients
$ chmod a+x ~/.Xclients
$ sudo yum groupinstall "GNOME Desktop" "Graphical Administration Tools"
$ sudo ln -sf /lib/systemd/system/runlevel5.target /etc/systemd/system/default.target
$ sudo reboot
$ sudo yum groupinstall -y "KDE Plasma Workspaces"
$ sudo ln -sf /lib/systemd/system/runlevel5.target /etc/systemd/system/default.target
$ sudo reboot
Create ~/.Xclients
$ echo "startkde" > ~/.Xclients
$ chmod a+x ~/.Xclients
2. Install xRDP server on your CentOS 7 box
$ sudo yum install -y epel-release
$ sudo yum install -y xrdp
$ sudo systemctl enable xrdp
$ sudo systemctl start xrdp
3. Open xRDP port in firewall
$ sudo firewall-cmd --add-port=3389/tcp --permanent
$ sudo firewall-cmd --reload
Finaly, now you can connect to your Linux desktop environment via xRDP.