Logo

How to Install and Configure VNC Server on Ubuntu 22.04

Jun 30, 2023

To install and configure a VNC server on Ubuntu 22.04 server, you can follow these steps:

Step 1 : Update the package lists and upgrade existing packages:

sudo apt update
sudo apt upgrade

Step 2 : Install the XFCE desktop environment and additional XFCE goodies:

sudo apt install xfce4 xfce4-goodies

Step 3 : Install the tightvncserver package, which provides the VNC server software:

sudo apt install tightvncserver

Step 4 : Set up a VNC password by running the following command:

tightvncserver

You will be prompted to enter a password for VNC access. Choose a strong password.

Step 5 : Stop the VNC server to make some configuration changes:

tightvncserver -kill :1

Step 6 : Create a new configuration file for the VNC server:

nano ~/.vnc/xstartup

Step 7 : In the text editor, remove the existing content and replace it with the following lines:

#!/bin/bash

xrdb $HOME/.Xresources
startxfce4 &

This configuration assumes that you want to use the XFCE desktop environment. If you prefer a different desktop environment, modify the startxfce4 command accordingly.

Step 8 : Save the file (Ctrl + O), and exit the text editor (Ctrl + X).

Step 9 : Make the xstartup file executable:

chmod +x ~/.vnc/xstartup

Step 10 : Start the VNC server again:

tightvncserver

Step 11 : You should now be able to connect to your VNC server from a VNC client application using the server's IP address or hostname followed by :1 (e.g., 192.168.1.100:1). Enter the VNC password you set earlier.

Congratulations! You have successfully installed and configured a VNC server on your Ubuntu 22.04 server. You can customize the configuration further based on your specific needs, such as changing the desktop environment or configuring a different resolution.

Recommended