xrdp is an Open Source Remote desktop Protocol server, which allows you to RDP to your Linux server from Windows machine; it is capable of accepting connections from rdesktop, freerdp, and remote desktop clients.
This post will help you to setup xrdp server on CentOS 7 / RHEL 7.
Prerequisites
1. First, install Gnome GUI on CentOS 7 / RHEL 7
2. xrdp is available in EPEL repository, so Install and configure EPEL repository.
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
Install xrdp on CentOS 7
Use YUM command to install xrdp package on CentOS 7 / RHEL 7.
yum -y install xrdp tigervnc-server
Output:
Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: centos.excellmedia.net * epel: del-mirrors.extreme-ix.org * extras: centos.excellmedia.net * updates: centos.excellmedia.net Resolving Dependencies --> Running transaction check ---> Package tigervnc-server.x86_64 0:1.8.0-2.el7_4 will be installed ---> Package xrdp.x86_64 1:0.9.5-1.el7 will be installed --> Processing Dependency: xorgxrdp for package: 1:xrdp-0.9.5-1.el7.x86_64 --> Running transaction check ---> Package xorgxrdp.x86_64 0:0.2.5-3.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ================================================================================================= Package Arch Version Repository Size ================================================================================================= Installing: tigervnc-server x86_64 1.8.0-2.el7_4 updates 213 k xrdp x86_64 1:0.9.5-1.el7 epel 413 k Installing for dependencies: xorgxrdp x86_64 0.2.5-3.el7 epel 61 k Transaction Summary ================================================================================================= Install 2 Packages (+1 Dependent package) Total download size: 688 k Installed size: 2.7 M Downloading packages: warning: /var/cache/yum/x86_64/7/epel/packages/xrdp-0.9.5-1.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 352c64e5: NOKEY Public key for xrdp-0.9.5-1.el7.x86_64.rpm is not installed (1/3): xrdp-0.9.5-1.el7.x86_64.rpm | 413 kB 00:00:01 (2/3): tigervnc-server-1.8.0-2.el7_4.x86_64.rpm | 213 kB 00:00:01 (3/3): xorgxrdp-0.2.5-3.el7.x86_64.rpm | 61 kB 00:00:01 ------------------------------------------------------------------------------------------------- Total 409 kB/s | 688 kB 00:00:01 Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 Importing GPG key 0x352C64E5: Userid : "Fedora EPEL (7) <epel@fedoraproject.org>" Fingerprint: 91e9 7d7c 4a5e 96f1 7f3e 888f 6a2f aea2 352c 64e5 Package : epel-release-7-11.noarch (installed) From : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 Running transaction check Running transaction test Transaction test succeeded Running transaction Warning: RPMDB altered outside of yum. Installing : xorgxrdp-0.2.5-3.el7.x86_64 1/3 Installing : 1:xrdp-0.9.5-1.el7.x86_64 2/3 Installing : tigervnc-server-1.8.0-2.el7_4.x86_64 3/3 Verifying : xorgxrdp-0.2.5-3.el7.x86_64 1/3 Verifying : tigervnc-server-1.8.0-2.el7_4.x86_64 2/3 Verifying : 1:xrdp-0.9.5-1.el7.x86_64 3/3 Installed: tigervnc-server.x86_64 0:1.8.0-2.el7_4 xrdp.x86_64 1:0.9.5-1.el7 Dependency Installed: xorgxrdp.x86_64 0:0.2.5-3.el7 Complete! </epel@fedoraproject.org>
Once xrdp is installed, start the xrdp service using the following command.
systemctl start xrdp
xrdp should now be listening on 3389. You can confirm this by using netstat
command.
netstat -antup | grep xrdp
Output:
tcp 0 0 0.0.0.0:3389 0.0.0.0:* LISTEN 1508/xrdp tcp 0 0 127.0.0.1:3350 0.0.0.0:* LISTEN 1507/xrdp-sesman
READ: netstat command not found on CentOS 7 / RHEL 7 – Quick Fix
By default, xrdp service won’t start automatically after a system reboot. Run the following command in the terminal to enable the service at system startup.
systemctl enable xrdp
Firewall
Configure the firewall to allow RDP connection from external machines. The following command will add the exception for RDP port (3389).
firewall-cmd --permanent --add-port=3389/tcp firewall-cmd --reload
SELinux
Configure SELinux
chcon --type=bin_t /usr/sbin/xrdp chcon --type=bin_t /usr/sbin/xrdp-sesman
Test xrdp Remote Connectivity
Connect to Your Machine Using Remote Desktop Connection
With xRDP and your desktop environment installed, you can now connect from your local machine to the remote machine.
How you do this depends on your operating system.
Connect from Windows
To connect to your server from Microsoft Windows, just search and launch the Remote Desktop Connection application and input your hostname or IP:
If this is your first time connecting, then you’ll receive some security warnings. Assuming this is your server and it is secure then just go ahead and confirm them.
Connect from Linux
To connect from a Linux machine, a great option for using remote desktop connection is Remmina. Remmina is a wonderful free and open-source remote desktop client that supports Remote Desktop Protocol, VNC, NX, XDMCP, SPICE and SSH protocols.
To use Remmina to connect from Linux to your remote machine, just run Remmina after installing it, click the `+` in the top left corner and fill in your remote machine’s IP/Hostname
, Username
and Password
.
If you’re running Debian/Ubuntu/CentOS/Fedora locally, you can install Remmina using the following commands:
Debian/Ubuntu
$ sudo apt-get install remmina remmina-plugin-*
CentOS/RHEL
$ yum install remmina remmina-plugins-*
Fedora 22
$ sudo dnf copr enable hubbitus/remmina-next
$ sudo dnf upgrade --refresh 'remmina*' 'freerdp*'
You'll notice we are also installing `remmina-plugins-*` because our main interest is installing the Remmina RDP plugin, as it may not be installed by default.You can find more detailed installation instructions, and instructions for other distros on their website, here How to install Remmina - Remmina.
Connect from OSX
To connect from your Mac, you'll first have to download the Microsoft Remote Desktop App from the App Store
After launching the app for the first time, you'll first want to create a new connection. To do this click on the `+` in the top left corner of the app window.The essential information you need here is for PC Name, User name and Password.
Just fill in the info for the 3 mentioned fields as follows:
PC Name - The IP or Host name of your remote machine. Most likely you'll want to use your IP.
User name - The username you used when installing xRDP and the desktop environment on your remote machine. Either `root` or your `sudo user`.
Password - Your CentOS user's login password.
After which the connection should be saved and you should be able to start the connection to the remote machine.
For additional info and support, you can read the instructions for Remote Desktop on Mac on Microsoft's Website.
Inchase you don't have Desktop Environment
Just Install Your Preferred Desktop Environment
Now we can install the desktop environment we’ll be using. In this guide we’ll try out XFCE, MATE, and GNOME.
If you’re looking for a lightweight and resource friendly solution, install XFCE.
NOTE: If you can’t connect via Remote Desktop Connection after you’ve installed the desktop environment, then open port
3389/tcp
using thefirewall-cmd
command mentioned above.
1. Install XFCE Desktop Environment
XFCE is one of the most lightweight desktop environments. It’s fast, low on system resources, while still visually appealing. Additionally, it has a very active community, so there are many customization options available.
To install XFCE, run the following commands:
$ sudo yum install -y epel-release
$ sudo yum groupinstall -y "Xfce"
$ sudo reboot
Next, create the .Xclients
file in the directory of the user you’re connecting with:
$ echo "xfce4-session" > ~/.Xclients
$ chmod a+x ~/.Xclients
Now you can connect to the server using Remote Desktop Connection.
Here is what XFCE looks like:
Uninstalling XFCE
To uninstall XFCE from your CentOS 7 machine, run the following commands:
$ sudo yum groupremove -y "Xfce"
$ sudo yum remove -y libxfce4*
2. Install MATE Desktop Environment
To install MATE, run the following commands:
$ sudo yum install -y epel-release
$ sudo yum groupinstall -y "MATE Desktop"
$ sudo reboot
Next, create the .Xclients
file in the directory of the user you’re connecting with:
$ echo "mate-session" > ~/.Xclients
$ chmod a+x ~/.Xclients
Now you can connect to the server using Remote Desktop Connection.
Here is what MATE looks like:
Uninstalling MATE
To uninstall MATE from your CentOS 7 machine, run the following commands:
$ sudo yum groupremove -y "MATE Desktop"
$ sudo yum autoremove -y
3. Install GNOME Desktop Evironment
We’ll now install GNOME 3.
To do this, we’ll just have to install the GNOME Desktop package group, which will install all the packages required for the GUI installation.
$ sudo yum groupinstall "GNOME DESKTOP" -y
This may take a while. There were ~1000 packages installed on a minimal CentOS 7 installation.
Start the GUI
Although we installed the GNOME Desktop package group, the GUI will not be loaded by default on reboot.
We can check this by running:
$ systemctl get-default
Output:
multi-user.target
If our default target is multi-user.target
, it means that the GUI will not be loaded. What we want is to set the default target to graphical.target
.
To do this, run the following commands:
$ sudo systemctl set-default graphical.target
Output:
Removed symlink /etc/systemd/system/default.target.
Created symlink from /etc/systemd/system/default.target to /usr/lib/systemd/system/graphical.target.
After which, run the following command to change to the GUI immediately:
$ sudo systemctl isolate graphical.target
That’s it. You can now connect via xRDP to your CentOS 7 machine using GNOME.
Here is what GNOME 3 looks like, the first time you connect after installing. Just follow the initial configuration steps to finish setting up.
Uninstalling GNOME
To uninstall GNOME from your CentOS 7 machine, run the following commands:
$ sudo yum groupremove -y "GNOME Desktop"
$ sudo yum autoremove -y
Source and reference :
No comments: