In this tutorial we will show you how to install VNC on Ubuntu 16.04. We will also install and configure its prerequisites. VNC (Virtual network computing) is a graphical desktop sharing system which will allow you to connect to a computer, view its graphical interface and control it remotely using a VNC client. It makes managing files, software, and settings on a remote server easier for users who are not yet comfortable with the command line.
I recommend to use a minimal Ubuntu server setup as a basis for the tutorial, that can be a virtual or a root server image with an Ubuntu 16.04 minimal install from a web hosting company or you use our minimal server tutorial to install a server from scratch.
Install VNC on Ubuntu 16.04
Step 1. First, ensure your system and apt package lists are fully up-to-date by running the following:
apt-get update -y apt-get upgrade -y
Step 2. Installing VNC.
First, install Graphical Desktop Environment and required packages of from official Ubuntu Repository:
sudo apt-get install xfce4 xfce4-goodies tightvncserver
Install the VNC server using the following command:
sudo apt-get install vnc4server
To finalize the installation just type vncserver in the command line to enter:
The setup will ask you to setup a password. Enter the password and confirm it. Then you will be asked to enter the view only password.
Step 3. Configuring Ubuntu VNC server.
First, stop TightVNC in Ubuntu by executing the following command:
vncserver -kill :1
We are now going to make some changes in the xstartup file:
### nano ~/.vnc/xstartup ~/.vnc/xstartup #!/bin/bash xrdb $HOME/.Xresources startxfce4 &
For VNC to execute this new startup file, we have to grant the privileges to execute the file:
sudo chmod +x ~/.vnc/xstartup
Next, restart the server:
Now, you will get the following output:
New 'X' desktop is your_name_server.com:1
Step 4. Testing the VNC.
You have to check your VNC. You have to connect to the remote server using SSH connection and forward the connection to the localhost connection:
ssh -L 5901:127.0.0.1:5901 -N -f -l username server_ip_address
If you are using Windows, install TightVNC and Putty.
Congratulation’s! You have successfully install and configured VNC on your Ubuntu 16.04 server. Thanks for using this tutorial installing VNC remote dekstop on Ubuntu 16.04 LTS (Xenial Xerus) system.