How to setup a VNC server (GUI) on Ubuntu

In this tutorial, we will install and setup a GUI/VNC server on an Ubuntu VPN package. We recommend using at least our Professional (2GB RAM) VPS package as VNC server requires more storage and RAM.


Setting up the VNC server

Run the commands below to install all required packages. In the installation process, you will be asked to select your Keyboard layout. Select the layout of the Keyboard accordingly.

sudo apt-get update && sudo apt-get upgrade
sudo apt-get install -y ubuntu-desktop gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal

Now, run the command below to install the VNC server.

sudo apt-get install -y vnc4server

Start the VNC server by running this command. This will ask you to enter a password for VNC. You will be required to enter this command when we connect to the VNC later.

vncserver :1

Run the command below.

echo "gnome-panel & gnome-settings-daemon & metacity & nautilus &" >> ~/.vnc/xstartup

Restart the VNC server by running:

vncserver -kill :1 && vncserver :1

Now run the command below to automatically start VNC server on reboot.

(crontab -l ; echo "@reboot /usr/bin/vncserver :1") | crontab -

You may see this error "no crontab for root" this can be ignored.

Installing VNC client

There are many VNC clients that you can use to connect to your server. We recommend using the RealVNC program. It can be downloaded for free here

Once downloaded, run the program and install it on your computer.

Open the RealVNC program. You will see a text area where you can enter the server hostname (IP address). Enter your IP address with port 5901. For example: 123.45.67.89:5901. Now Press Enter to connect to the server. You will have to enter the password that we used earlier. You may receive an error saying the connection is not encrypted. This message can be ignored.


  • 5 Users Found This Useful
Was this answer helpful?

Related Articles

How to connect to your VPS server using SSH

In this tutorial, we will look at how to connect to your VPS server using an SSH client. You will...

How to Install Apache/MySQL/PHP on Ubuntu

In this tutorial, we will look into how to install Apache/MySQL/PHP (LAMP Stack) on your Ubuntu...

Installing Minecraft on your VPS

In this tutorial, we will install Java and setup a Minecraft server on an Ubuntu VPS server. 1....