UbuntuUbuntu Based

How To Install VNC Server on Ubuntu 24.04 LTS

Install VNC Server on Ubuntu 24.04

In this tutorial, we will show you how to install VNC Server on Ubuntu 24.04 LTS. Virtual Network Computing (VNC) is a versatile remote desktop protocol that allows users to access and control a computer remotely. It enables seamless interaction with a graphical desktop environment from anywhere, making it an essential tool for remote administration, troubleshooting, and collaboration.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the VNC Server on Ubuntu 24.04 (Noble Numbat). You can follow the same instructions for Ubuntu 22.04 and any other Debian-based distribution like Linux Mint, Elementary OS, Pop!_OS, and more as well.

Prerequisites

  • A server running one of the following operating systems: Ubuntu and any other Debian-based distribution like Linux Mint.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • SSH access to the server (or just open Terminal if you’re on a desktop).
  • Basic command-line knowledge for navigating and executing commands,
  • An active internet connection. You’ll need an internet connection to download the necessary packages and dependencies.
  • An Ubuntu 24.04 system with root access or a user with sudo privileges.

Install VNC Server on Ubuntu 24.04

Step 1. Updating the Package Repository.

It’s crucial to have your Ubuntu system up-to-date. Run the following commands to ensure you have the latest packages:

sudo apt update
sudo apt upgrade

These commands will refresh the package list and upgrade any outdated packages to their latest versions.

Step 2. Installing the Desktop Environment.

To provide a graphical interface for remote access, you need to install a desktop environment on your Ubuntu server. XFCE is a lightweight and customizable desktop environment that strikes a balance between functionality and resource efficiency. To install XFCE, follow these steps:

sudo apt install xfce4 xfce4-goodies

Verify the installation by checking the XFCE version:

xfce4-session --version

A successful installation will display the XFCE version number.

Step 3. Installing VNC Server on Ubuntu 24.04.

For this guide, we will use TigerVNC, a popular and high-performance VNC server. To install TigerVNC on Ubuntu 24.04 LTS, follow these steps:

Install TigerVNC server and its dependencies:

sudo apt install tigervnc-standalone-server tigervnc-common tigervnc-xorg-extension tigervnc-viewer

Verify the installation by checking the TigerVNC version:

vncserver --version

Step 4. Configuring VNC Server.

With TigerVNC installed, it’s time to configure the server for remote access:

Create a VNC password for authentication:

vncpasswd

Create the xstartup file to define the startup script:

mkdir -p ~/.vnc
echo '#!/bin/sh' > ~/.vnc/xstartup
echo 'xrdb $HOME/.Xresources' >> ~/.vnc/xstartup 
echo 'startxfce4 &' >> ~/.vnc/xstartup

Make the xstartup file executable:

chmod +x ~/.vnc/xstartup

Configure the display resolution by editing the config file:

echo 'geometry=1920x1080' >> ~/.vnc/config

Secure your VNC server by restricting access to localhost:

echo 'localhost' >> ~/.vnc/config

This step ensures that VNC connections are only allowed from the local machine.

Step 5. Starting and Managing VNC Server.

With the configuration in place, you can now start the VNC server:

Start the VNC server manually:

vncserver

To create multiple VNC sessions, specify a different display number:

vncserver :2

To stop a VNC session, use the following command:

vncserver -kill :1

To view active VNC sessions, run:

vncserver -list

This command will list all running VNC sessions along with their display numbers.

Step 6. Connecting to VNC Server.

To connect to your VNC server, you need a VNC client on your local machine. Install a VNC client on your local machine, such as Remmina:

sudo apt install remmina

Establish an SSH tunnel for secure remote access:

ssh -L 5901:localhost:5901 -N -f -l username remote_server_ip

Replace username with your Ubuntu username and remote_server_ip with the IP address of your VNC server.

Congratulations! You have successfully installed VNC Server. Thanks for using this tutorial for installing the VNC Server on the Ubuntu 24.04 LTS system. For additional help or useful information, we recommend you check the official TigerVNC website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button