Installing a Graphical User Interface (GUI) on a Linux system isn’t mandatory as system administration and configuration can be done through SSH. However, a GUI offers advantages, especially for Windows users new to terminals. It can be a cost-effective way to manage a Linux server without a Windows license, simplifying complex tasks. The terminal remains relevant, but tasks like file management and configuration editing become more straightforward with a GUI. This tutorial guides through installing XFCE4 GUI and XRDP on CentOS and Debian systems, divided into three sections: meeting prerequisites, software installation, and connecting to the server.
Prerequisites
-
An already installed instance running any Linux operating system: This means you have a Linux system up and running.
-
A working internet connection: You need an internet connection to download and install the necessary software packages.
-
A VNC client or SSH client: A VNC client allows you to connect to a remote computer and view its desktop, while an SSH client allows you to connect to a remote computer and execute commands.
-
A user which is allowed to log in to the operating system: This means you have a user account with the necessary privileges to install software and make changes to the system.
-
A little bit work on the terminal either via SSH or VNC: You should be comfortable working with the terminal, which is a text-based interface for interacting with the Linux system.
Installation and Configuration:
Step 1: Create a new user
Use the following command to create a new user:
useradd -m -s /bin/bash USERNAME
Replace USERNAME
with the desired username.
Step 2: Update the package manager database and install XRDP and the GUI
Ubuntu-based systems:
apt update
apt install xrdp vnc4server xubuntu-desktop
CentOS-based systems:
yum install -y epel-release
yum groupinstall "Server with GUI" -y
yum -y install xrdp tigervnc-server
Step 3: Configure XRDP
3.1: Create a TLS certificate
Use the following command to create a TLS certificate:
openssl req -x509 -newkey rsa:2048 -nodes -keyout xrdp.key.pem -out xrdp.crt.pem -days 3650
3.2: Set file permissions
Set the file permissions for the TLS certificate and key:
chown root:root xrdp*.pem
chmod 640 xrdp*.pem
3.3: Move files to /etc/xrdp
Move the TLS certificate and key to the /etc/xrdp
directory:
mv xrdp*.pem /etc/xrdp
3.4: Edit the xrdp.ini file
Open the xrdp.ini file for editing:
nano /etc/xrdp/xrdp.ini
Locate the following lines and change them to match the following:
security_layer = TLS
certificate = /etc/xrdp/xrdp.crt.pem
key_file = /etc/xrdp/xrdp.key.pem
Step 4: Verify that the system starts into the graphical target
Check if the system starts into the graphical target:
systemctl get-default
If the output is not graphical.target
, set it as the default target:
systemctl set-default graphical.target
Step 5: Enable the xrdp service
Enable the xrdp service:
systemctl enable xrdp.service
Step 6: Set the desktop environment for the created user
Set the desktop environment for the newly created user:
echo „xfce4-session“ > /home/USERNAME/.xsession
chown USERNAME: /home/USERNAME/.xsession
Replace USERNAME
with the username you created in Step 1.
Step 7: Reboot the server
Reboot the server:
reboot
Connection
After the server is rebooted, you should be able to connect to it via RDP using an RDP client. This allows you to control the system remotely using a graphical desktop environment.
Conclusion
This tutorial has provided step-by-step instructions on how to install GUI and XRDP on Ubuntu and CentOS operating systems. By following these instructions, you will be able to remotely access your Linux system using a graphical desktop environment. This can be useful for a variety of tasks, such as managing your system, installing software, and working on documents.
Key takeaways:
- The prerequisites for installing a GUI and XRDP are a working internet connection, a VNC or SSH client, a user with login privileges, and a little bit of experience working with the terminal.
- The installation and configuration process involves updating the package manager database, installing XRDP and the GUI, configuring XRDP, checking the system startup target, enabling the xrdp server, setting the desktop environment, and rebooting the server.
- Once the server is rebooted, you can connect to it via RDP using an RDP client.