ANNEX: VNC server and viewer

VNC server alternatives in Ubuntu

TightVNC in Ubuntu 14.04

VNC4server in Ubuntu 14.04

VNC4server is the one installed in RASPEX Ubuntu 14.04.

Simply start it with the command:


That will tell you the local URL (raspberry) and display number (2).

X11VNC server in Raspberry Pi & Odroid with Ubuntu 14.04

UPDATE install in Ubuntu 16.04:
UPDATE install in Ubuntu 16.04:

Install and configure

sudo apt-get install x11vnc

Odroid runs in his original Ubuntu Trusty image X11VNC server

This tutorial allows you to auto-start the VNC server on boot

Create "" in /home/pi/

#! /bin/sh
x11vnc -usepw -forever -display :0 -geometry 1920x1080

The option -usepw will make mandatory to enter the password (see below how to set ii).

And make it executable:

chmod u+x

Create "VNC Autostart" in home/pi/.config/autostart naming the files as vnc-autostart.desktop

[Desktop Entry]

Name=VNC Autostart

And make sure that this script is owned by pi user, as well as
Adafruit tutorial

And these commands show you how to manually access all the commands you may execute 

# Set a password
mkdir ~/.x11vnc
x11vnc -storepasswd <em>password</em> ~/.x11vnc/passwd
# Launch display 0(access port 5900)
x11vnc -display:0

If you need to stop the server: 

x11vnc -R stop
# Or specifying a display
x11vnc -display&nbsp;:0 -R stop
# And start it again
x11vnc -forever -display :0

And for starting it again using the script:


TightVNC in Raspbian

sudo apt-get install tightvncserver

Start a VNC server from the terminal. This example starts a session on VNC display one (:1) with full HD resolution:

vncserver :1 -geometry 1920x1080 -depth 24

Note that since by default an X session is started on display zero, you will get an error in case you use :0

Since there are now two X sessions running, which would normally be a waste of resources, it is suggested to stop the displaymanager running on:0 using

service lightdm stop

Now, on your computer, install and run the VNC client:

sudo apt-get install xtightvncviewer

Otherwise, TightVNC is downloadable from


You can create a simple file with the command to run the VNC server on the Pi, to save having to remember it:

  • Create a file containing the following shell script

vncserver :1 -geometry 1920x1080 -depth 24 -dpi 96
  • Make the file executable:

chmod +x
  • Then you can run it at any time with:

To run at boot:

sudo su
cd /etc/init.d/

Create a new file here containing the following script vncboot:

#! /bin/sh
# /etc/init.d/vncboot

# Provides: vncboot
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start VNC Server at boot time
# Description: Start VNC Server at boot time.


export USER HOME

case "$1" in
  echo "Starting VNC Server"
  #Insert your favoured settings for a VNC session
  su - $USER -c "/usr/bin/vncserver :1 -geometry 1280x800 -depth 16 -pixelformat rgb565"

  echo "Stopping VNC Server"
  /usr/bin/vncserver -kill :1

  echo "Usage: /etc/init.d/vncboot {start|stop}"
  exit 1

exit 0

Make this file executable:

chmod 755 vncboot

Enable dependency-based boot sequencing:

update-rc.d lightdm remove
update-rc.d vncboot defaults

If enabling dependency-based boot sequencing was successful, you will see this:

update-rc.d: using dependency based boot sequencing

Reboot your Raspberry Pi and you should find a VNC server already started.