Image

Knowledge base → Installing KDE and setting up a VNC server on Linux Debian 12

[Virtual servers]
Date of publication: 15.10.2023

Typically, Linux is used only as a server and management occurs via ssh access, unlike Windows, where a graphical shell is used for remote access via the RDP protocol.

In this article we will look at installing the KDE Desktop graphical shell on a VPS server with Linux Debian 12 and setting up remote access to the desktop via a VNC server. Thus, we will be able to work in Linux through a graphical shell, thereby obtaining a full-fledged workstation with the possibility of remote access, similar to that in Windows.

Please note that the graphical shell requires more resources, in particular RAM, we recommend that if you use a server with a graphical shell, add 4 GB of RAM and 2 CPU cores to the configuration; as for the size of the SSD disk, the installation itself takes no more than 1 GB

We will install as root user.

1. Install KDE Desktop

apt update
apt upgrade
apt install task-kde-desktop

1.1 Setting the interface language and encoding

localectl set-locale LANG=en_US.UTF-8

2. Installing a VNC server

apt install tigervnc-standalone-server tigervnc-common -y

2.1 If necessary, add a user

adduser username
su - username
vncpasswd
exit

2.2 We will connect as root, so we will set a password

vncpasswd

Would you like to enter a view-only password (y/n)?, answer: n (no).

3. Create a configuration file for the graphical shell

vim ~/.vnc/xstartup

#!/bin/sh
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid gray
vncconfig -iconic &
/usr/bin/startkde &

3.1 Copy the file

cp /etc/X11/Xresources/x11-common ~/.Xresources

3.2 Reboot the server

reboot

4. Starting a VNC server

vncserver -rfbport 5901 -localhost no

4.1 Now use the VNC Viewer application to connect, specifying your ip as the server and the specified port in the application.

xx.ip.xx.ip:5901

4.2 VNC Autostart

In our example, after rebooting the server, the VNC service will have to be started again from the console in order to add the command in step 4 to autorun, use this guide through the rc.local file.





No Comments Yet