How to install VNC and GNOME Desktop on Ubuntu 16.04

Once I needed to use a Chrome extension on my VPS. So I had two options, buy a Windows VPS or install a desktop environment on a linux VPS. I chose the second options as it costs less. At that time, I though that installing a VNC with a desktop environment on a VPS is a tough task. But it wasn’t. It’s really simple.

What is VNC?

Virtual Network Computing (VNC) is a graphical desktop sharing system. It allows one computer to control another computer remotely through mouse and keyword, what we usually do. Windows VPSs comes with RDP which allows us to do this out of the box. But Linux VPSs does come with any graphical desktop sharing system. That’s why we need to install a VNC.

Install VNC and GUI

Before installing a VNC, we need to setup a graphical user interface in the VPS. There are many popular GUIs like; GNOME, KDE Plasma and Xfce. In this guide I am using GNOME as the Desktop environment.

First, we need to update our VPS.

sudo apt-get update && sudo apt-get upgrade -y

Then we have to install the GNOME.

sudo apt-get install ubuntu-desktop gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal

Let’s install a VNC server. I am going to use vnc4server in this guide

sudo apt-get install vnc4server

To start a session in VNC server,

vncserver :1

:1 means the port. So your VNC server is running at YOUR_SERVER_IP:1. The first time when this command gets executed, it requires you to put a password. You can give any password. Now you should able to connect to the VNC server through a VNC client software like realVNC Viewer which is available on almost every platform; macOS, Windows, Android and iOS.

You may also read: How to setup your own VPN server 2021

Is the job done? No, not yet. If you got a grey background, don’t worry.

First, kill the VNC session.

vncserver -kill :1

Then we have to edit the ~/.vnc/xstartup file. Open this file using any text editor you prefer, I am using nano; my favourite.

Please note that you need to start a VNC session at least once to create this file.

nano ~/.vnc/xstartup

Now replace the whole file with following lines.


# Uncomment the following two lines for normal desktop:
# exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
x-window-manager &

gnome-panel &
gnome-settings-daemon &
metacity &
nautilus &

Then save the file. Press ctrl+x, then y and then enter, to save the file. So we have done the GUI configuration part.

Next, start the VNC server.

vncserver :1

Then again connect to the VNC server through a VNC client software like realVNC Viewer.

Posted by
Team ProMAX

TheProMAX is backed by Team ProMAX. We’re dedicated to providing you the very best of us.

Leave a Reply

Your email address will not be published. Required fields are marked *