Turning a Linux VPS into a full-fledged PC: Setting up VNC in 10 minutes
Greetings, friends!
Deploying a Graphical User Interface (GUI) on a virtual server becomes necessary when the console SSH interface is no longer enough. Working with graphical software, testing browser automation (Selenium, Puppeteer), running an IDE, or operating specialized software requires full visual control.
In this guide, we will cover how to deploy a lightweight yet functional Xfce desktop environment and configure a secure VNC connection using the TigerVNC server on Ubuntu / Debian.
Key Takeaways: Main Conclusions
Xfce is the best choice for VPS: Heavy desktop environments (GNOME, KDE) consume gigabytes of RAM. The Xfce environment uses only 250–300 MB of RAM, leaving maximum server resources for your actual tasks.
VNC Traffic Security: The VNC protocol transmits graphical streams and passwords unencrypted. It is strictly recommended NOT to open the VNC port (5901) directly to the internet. The only safe method is tunneling through SSH.
TigerVNC as the Standard: Unlike the outdated
tightvncserver, TigerVNC supports current X11 extensions, optimizes image compression better, and works more reliably with the clipboard.
Video Guide
We recorded a video demonstrating the entire installation process on your Ubuntu server. You can watch it right here:
Linux Remote Desktop Architecture
The connection setup for a Linux VPS remote desktop consists of three components:
Desktop Environment (DE): The graphical user interface (Xfce) responsible for rendering windows, menus, and the desktop.
VNC Server (TigerVNC): The service translating the X11 virtual display into the RFB (Remote Framebuffer) network protocol.
SSH Tunnel: An encrypted channel forwarded from your local computer to the server to secure VNC traffic.
Step-by-Step Configuration Guide
Step 1: Installing Xfce and TigerVNC
Connect to your VPS via SSH as a user with sudo privileges:
sudo apt update && sudo apt upgrade -y
sudo apt install xfce4 xfce4-goodies tigervnc-standalone-server tigervnc-xorg-extension -y
Step 2: Initializing and Setting a Password Run the VNC server once to generate the initial configuration file structure and set an access password:
vncserver
The system will prompt you to enter and confirm a VNC password (6 to 8 characters in length).
When asked
Would you like to enter a view-only password?, answern(unless you need a read-only password).
Kill the test VNC process:
vncserver -kill :1
Step 3: Configuring the xstartup Autostart Script
Create a configuration file that instructs TigerVNC which desktop environment to launch on startup.
Edit the ~/.vnc/xstartup file:
nano ~/.vnc/xstartup
Insert the following content:
#!/bin/sh
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
exec startxfce4
Make the file executable:
chmod +x ~/.vnc/xstartup
Step 4: Setting Up the VNC systemd Service
To ensure the VNC server automatically launches upon system reboot, create a system service file.
Create the service file:
sudo nano /etc/systemd/system/[email protected]
Insert the configuration (replace your_username with your actual system username):
[Unit]
Description=Start TigerVNC server at startup
After=syslog.target network.target
[Service]
Type=forking
User=your_username
Group=your_username
WorkingDirectory=/home/your_username
PIDFile=/home/your_username/.vnc/%H:%i.pid
ExecStartPre=-/usr/bin/vncserver -kill :%i > /dev/null 2>&1
ExecStart=/usr/bin/vncserver -depth 24 -geometry 1920x1080 -localhost yes :%i
ExecStop=/usr/bin/vncserver -kill :%i
[Install]
WantedBy=multi-user.target
Note: The -localhost yes flag forces the VNC server to listen only on 127.0.0.1. This blocks direct incoming connections from the internet, keeping your server safe.
Reload systemd, enable autostart, and launch the service on display :1 (port 5901):
sudo systemctl daemon-reload
sudo systemctl enable [email protected]
sudo systemctl start [email protected]
Secure Connection via SSH Tunnel Since our VNC server accepts local connections only, you must forward an SSH tunnel from your PC to log in.
On your local computer (Windows / macOS / Linux): Run the following command in your local terminal:
ssh -L 5901:127.0.0.1:5901 -N -f -l your_username your_server_ip
The parameter -L 5901:127.0.0.1:5901 binds local port 5901 on your PC to port 5901 on the VPS.
Connecting via a VNC Client:
Download and install a VNC client (e.g., RealVNC Viewer or TigerVNC Viewer).
In the server address field, enter:
localhost:5901or127.0.0.1:5901.Enter the VNC password created in Step 2.
You will see your VPS Xfce desktop environment.
VNC Performance Optimization Checklist
If the graphical interface feels sluggish or laggy:
Reduce Color Depth: In
/etc/systemd/system/[email protected], change-depth 24to-depth 16.Lower Resolution: Change
-geometry 1920x1080to-geometry 1280x720.Disable Desktop Effects: In Xfce settings (Settings -> Window Manager Tweaks -> Compositor), turn off transparency and shadow effects.
FAQ: Frequently Asked Questions
How does VNC differ from RDP (Remote Desktop Protocol)? RDP transmits interface rendering instructions and is optimized for low-bandwidth connections (standard on Windows). VNC operates at a lower level, sending raw screen raster data (pixels). Therefore, VNC is more universal across Linux distros, but demands higher network bandwidth.
Can I set up RDP instead of VNC on a Linux VPS? Yes. To do so, install
xrdpon top of Xfce. This allows you to connect to Linux using the native Windows Remote Desktop Connection (mstsc) without manual tunnel setups.What should I do if I only see a black/grey screen with a crosshair cursor upon connecting? This indicates that the VNC server started, but failed to execute the
~/.vnc/xstartupscript. Verify that executable permissions were granted (chmod +x ~/.vnc/xstartup) and thatexec startxfce4is spelled correctly.
Conclusion
Configuring a VNC server transforms a traditional headless VPS into a complete remote workstation. Combining the lightweight Xfce environment, TigerVNC server, and an encrypted SSH tunnel achieves a balance between performance, minimal RAM usage, and full network security.
For a smooth experience with GUIs and video streaming, low network latency and fast disk I/O are critical to prevent UI stutters.
Personally, I use GNOME on our Hourly Cloud servers and find it exceptionally convenient because you can connect directly through the browser inside our admin panel.
If you need a powerful and responsive Linux desktop, explore NVMe Cloud VPS options from MivoCloud. Our infrastructure—built on pure KVM, fast Enterprise NVMe drives, and 1 Gbps+ high-speed network channels—ensures smooth desktop operations and instant application response times.
Article Author: Anatolie Cohaniuc

