https://www.itzgeek.com/how-tos/linux/centos-how-tos/install-xrdp-on-centos-7-rhel-7.html
summarize and expand on this thread for anyone else reading this, who is trying to get an alternative desktop working on a fresh install of the latest CentOS 7. The webpage you linked to is pretty good, but it's missing some small details like SELinux support and the need for xorgxrdp
. I've also added some of my own sysadmin experiences.
At the time of writing, the following versions apply:-
Software | Version |
---|---|
CentOS | 7.7 |
xrdp RPM | 0.9.11-5 |
xorgxrdp RPM | 0.2.11-1 |
-
Ensure the OS is up to date with
sudo yum update
-
Install EPEL repository with
sudo yum install epel-release
-
Install and enable XRDP with:-
sudo yum install xrdp sudo systemctl enable --now xrdp sudo systemctl enable --now xrdp-sesman
-
If you're using the firewall, allow external access to TCP port 3389 with:-
sudo firewall-cmd --add-port=3389/tcp --permanent sudo firewall-cmd --reload
-
If you're using SELinux,
sudo yum install xrdp-selinux
-
If you want to use the Xorg backend in addition to (or instead of) the Xvnc backend, do the following. The differences between the two backends are covered elsewhere.
sudo yum install xorgxrdp
- Edit
/etc/xrdp/xrdp.ini
. If the[Xorg]
section is commented out, uncomment it. - If you changed
xrdp.ini
,sudo systemctl restart xrdp
to pick up the changes.
-
Install your desktop(s), making sure that you use a command to install the whole desktop rather than a subset of it. This will probably be a
yum groupinstall
command. For example, for MATE, usesudo yum groupinstall "MATE Desktop"
. -
The default desktop for XRDP on CentOS 7 is GNOME. If you want the default desktop for all XRDP users to be something else, create the file
/etc/sysconfig/desktop
and set the PREFERRED variable to the command to start the desktop. For example, this/etc/sysconfig/desktop
sets the default desktop to MATE for all XRDP users:-# This file is read by /etc/X11/xinit/Xclients if the user does not # override it - see /etc/X11/xinit/Xsession for details # Set the default desktop for all users PREFERRED=mate-session
-
XRDP users who want to use a desktop other than the default will need to soft-link the command to start the correct session in to
~/.xsession
or~/.Xclients
. For MATE, this command is adequate:-ln -sf /usr/bin/mate-session ~/.xsession
As an aside, some websites suggest creating a vanilla file
~/.xsession
containing the command to start the desktop. That's OK too, but you have to remember to make the file executable. The soft-link method avoids this pitfall.
That should get the desktop running. Here are a couple of gotchas:-
- Some desktops expect GDM to be running to provide some of their functionality over DBUS. For example, the GNOME lock screen is implemented in GDM. If you're using one of these desktops you may need to enable GDM on the machine console (if it isn't enabled already):-
sudo yum install gdm xorgxrdp xrdp-selinux //必须要 sudo systemctl set-default graphical sudo systemctl isolate graphical
- When using the Xvnc backend, you may need to set the colour depth on the client to 24 or 32 if the desktop, or the applications require mesa 3D support. The Xorg backend always runs at a suitable colour depth.
I think that's it, but please let me know if I've left anything out.