Installing KDE Plasma Desktop Environment and XRDP service on Remote Ubuntu 22.04

In this guide, we'll walk you through the step-by-step process of installing the KDE Plasma desktop environment and XRDP service on your Ubuntu 22.04 server, enabling you to access a graphical interface and enjoy a streamlined desktop environment.

Prerequisites

You already log in to your remote Linux server
Once your server is deployed, the login credentials are usually sent to your registered email. You can also get server login information, including username, password, and port in the Database Mart control panel, please refer to guide on how to manage servers in Database Mart control panel.

Please refer to the guide How to Connect to a Linux Server Remotely to log in to your Remote Linux Server. Next, input your login password as prompted.

Log in to Linux servers

Install KDE Plasma Desktop Environment and XRDP Service on Remote Ubuntu 22.04 Servers

Before the desktop environment installation, you should know which KDE package to install. There are several variants of KDE packages avaiable. They are KDE Full, KDE Standard, and KDE Plasma Desktop.

KDE Full

It is the complete KDE pack that include the KDE Plasma desktop environment and its associated applications and utilities. By installing KDE Full, you have access to the complete KDE Plasma ecosystem, allowing you to have a comprehensive and feature-rich desktop environment. However, the complete pack is around 1GB, it will take some time in downloading and installing. You should also consider if your VPS has enough space for the full package. You can install it using the following command:

apt install kde-full
KDE Standard

The KDE Standard includes the KDE Plasma Desktop and a selection of the most common used applications. The focus is generally on providing a functional and user-friendly desktop environment out of the box. Normally, KDE standard is recommended. You can install it using the following command:

apt install kde-standard
KDE Plasma Desktop

The installation of KDE Plasma Desktop refers to a bare-minimum installation. It only includes basic utilities like a file manager, browser, and terminal emulator. You can install it using the following command:

apt install kde-plasma-desktop

Install KDE Plasma on Ubuntu Servers

In this example, we will use the Ubuntu 22.04 operating system.

As the following several operations require the root permission, we will switch to the root user first using the command below.

sudo -i
Switch to the root user by running command sudo -i

After that, issue the commands below to update your list of packages, followed by installing KDE Plasma pacakge. There are several variants of the KDE package. They are KDE Full, KDE Standard, and KDE Plasma Desktop. In this example, we will install the minimal package - KDE Plasma Desktop

apt update -y
apt install kde-plasma-desktop
Run apt update
Install KDE Plasma Desktop

Before the installation, you are often prompted to confirm the disk space this operation will use. Input "y" to continue the installation.

After the installation, you will be prompted to choose the services that need to be restarted. Then, press enter to restart the chosen services.

Choose the services to be restarted

Install XRDP on Ubuntu

XRDP is a protocol that allows you to connect to your Ubuntu system remotely using the Remote Desktop Protocol (RDP).

Issue the commands below to install xrdp service.

apt install xrdp -y
Install XRDP

After installing xrdp, you will also be prompted to decide which service should be restarted. Press enter to confirm with your choices.

Confirm the services should be restarted

Configure XRDP

This command uses sed to replace the "new_cursors=true" line with "new_cursors=false" in the xrdp.ini file. This change is necessary to avoid a cursor issue that can occur with XRDP.

sed -e 's/^new_cursors=true/new_cursors=false/g' \ -i /etc/xrdp/xrdp.ini
restart XRDP service

Because xrdp need to use /etc/ssl/private/ssl-cert-snakeoil.key whose unix group is ssl-cert , so we need to add xrdp into this group.

adduser xrdp ssl-cert
Add XRDP to ssl-cert group

Now, we will configure that the KDE Plasma session is started when you log in via XRDP. The cat command is used to create a .xsessionrc file with the specified environment variables. After executing these commands, the ~/.xsession and ~/.xsessionrc files will be created or overwritten with the specified content. These files are typically used during the X session startup process to set environment variables and define the startup command or script to be executed.

echo "/usr/bin/startplasma-x11" > ~/.xsession
D=/usr/share/plasma:/usr/local/share:/usr/share:/var/lib/snapd/desktop
C=/etc/xdg/xdg-plasma:/etc/xdg
C=${C}:/usr/share/kubuntu-default-settings/kf5-settings
cat < ~/.xsessionrc
export XDG_SESSION_DESKTOP=KDE
export XDG_DATA_DIRS=${D}
export XDG_CONFIG_DIRS=${C}
EOF
Configre that the KDE Plasma session is started when you log in via RDP

Then, we enable and restart the XRDP service using the following command.

systemctl enable xrdp
systemctl restart xrdp
Enable and restart XRDP service

Test the RDP Connection

Now, we can test if you can connect to the remote Ubuntu server using RDP.

Open RDP service on your local machine. Then, input your Linux Ubuntu server IP in the Computer field and click Connect.

Open RDC

Then, you can see the RDP login interface. Enter your Linux server login username and password and click OK.

Enter login username and password

With the authentication passed, you should be able to access your Ubuntu Desktop environment.

KDE Plasma desktop environment