Setting up VNC on the raspberry pi

The Raman spectrometer’s CCD is driven and read by a nucleo F401re, which is (or rather, it will be) connected to a raspberry pi B+.¹ The rpi can then be accessed over VNC (or directly if you prefer).

The following steps may be found at, I’m putting it here only for my own sake.

The latest Raspbian Wheezy² image was downloaded and dd’ed onto a microSD card. The standard password was changed to something much more cool. The wireless network was configured after which the rpi was accessed solely through ssh:

ssh pi@

A VNC server was installed and configured on the rpi:

sudo apt-get install tightvncserver

A VNC client was installed on my laptop:

sudo apt-get install xtightvncviewer

The file vncboot was created in /etc/init.d/ containing

# 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.

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


export USER HOME

case "$1" in
  echo "Starting VNC Server"
  #Insert your favoured settings for a VNC session
  su - pi -c "/usr/bin/vncserver :1 -geometry 800x600 -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

The file was rendered executable and make sure it’s run on boot:

chmod 755 vncboot
update-rc.d vncboot defaults

And remote graphical access is now available:


¹ Please don’t remind me about the rpi 2, it came out a week after I bought the rpi B+ for this project.
² Debian has switched to systemd with Jessie, and so these steps no longer work.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.