Skip to main content

[Ubuntu] How to install VNC for access to the server with Ubuntu 24.04

Updated over a week ago

A VNC is a graphical desktop sharing system to access another computer remotely. When installed on a server with Ubuntu 24.04, it provides desktop access to the server.

Requirements:

Virtualization server with Ubuntu installed.
Root access via SSH.

1. Update the current package list and upgrade it:

sudo apt update 
sudo apt upgrade

2. Install the selected desktop environment.

To install XFCE, enter:

sudo apt install xfce4 xfce4-goodies

3. Install and configure Virtual Network Computing (VNC)

  • Use the following command to install TightVNC:

apt install -y tightvncserver
  • Set the password:

vncpasswd
  • Start the VNC service:

vncserver

With the service startup, a default configuration directory at ~/.vnc/, with the file configuration xstartup is created.

  • We need to stop the VNC service to modify the configuration file:

vncserver -kill :1
nano ~/.vnc/xstartup
  • Replace the content with the following lines to start the XFCE desktop:

#!/bin/sh 
xrdb $HOME/.Xresources
startxfce4 &
  • Make the xstartup file executable:

chmod +x ~/.vnc/xstartup
  • Use the following commands to restart the desktop process.

vncserver -kill :1 
vncserver

3. Connect to the VNC Server

ip_address::port

Did this answer your question?