A quick step-by-step guide to setting up a Raspberry Pi.


1. Preparing an SD card

Download the latest Raspbian “Jessie” Image.

Write the Raspbian image to a 4GB (8GB is much better) (micro)SD card using Win32DiskImager.


2. The first boot up

Insert the freshly created (micro)SD card with the Raspbian Image.

Connect the Raspberry Pi to the network, and connect the power.

Find the Raspberry Pi on the network and SSH to it (using PuTTY or similar).

 → Username: pi

 → Password: raspberry

Use raspi-config application to:

 → Change your password!

 → Change your hostname to something unique.

 → Expand root partition to fill the (micro)SD card - may happen automatically.

 → Change memory split to 32MB (the default is 64MB).


3. Update the Raspberry Pi

Reconnect and update the system:

 → sudo apt-get update

 → sudo apt-get upgrade (or dist-upgrade)

Reboot!

 → sudo shutdown -r now   (or sudo reboot)


4. Install and set up VNC

Install the TightVNC server software:

 → sudo apt-get install tightvncserver

Run TightVNC and set a password:

 → /usr/bin/tightvncserver

Connect to the Raspberry Pi with a VNC client:

 → VNC://<IP Address>:1

#!/bin/sh
### BEGIN INIT INFO
# Provides:          tightvncserver
# Required-Start:    $local_fs
# Required-Stop:     $local_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start/Stop tightvncserver
### END INIT INFO

# Set the USER variable to the name of the User that starts tightvncserver.
export USER='pi'

eval cd ~$USER

case "$1" in
  start)
    su $USER -c '/usr/bin/tightvncserver :1'
    echo "Starting TightVNC server for $USER."
    ;;
  stop)
    pkill Xtightvnc
    echo "TightVNC server stopped!"
    ;;
  *)
    echo "Usage: /etc/init.d/tightvncserver {start|stop}"
    exit 1
    ;;
esac
exit 0

5. Configuring TightVNC to Autostart

Create the autostart script "/etc/init.d/tightvncserver" (see below):

 → sudo nano /etc/init.d/tightvncserver

Change the script so it is owned by root (standard for init files):

 → sudo chown root:root /etc/init.d/tightvncserver

Make the script executable:

 → sudo chmod 755 /etc/init.d/tightvncserver

Add the script to the default runlevels:

 → sudo update-rc.d tightvncserver defaults

Reboot to make sure it's all works:

 → sudo shutdown -r now   (or sudo reboot)


sudo nano /etc/init.d/tightvncserver sudo chown root:root /etc/init.d/tightvncserver sudo chmod 755 /etc/init.d/tightvncserver sudo update-rc.d tightvncserver defaults A Lizard A Gear Wheel A Gear Wheel A Gear Wheel A Pin Up Raspberry Pi Logo

6. TightVNC Autostart Script Properties

pi@modelb+ ~ $ ls -l /etc/init.d/tightvncserver

-rwxr-xr-x 1 root root 645 Feb 14 03:14 /etc/init.d/tightvncserver

Warning!
If the TightVNC Autostart Script is not exactly 645 bytes long, or the update-rc.d command complains, then check your character encoding (ANSI etc) and your line-end codes (CR/LF, LF).

Download the  TightVNC Autostart Script Published on Important Note This guide as written before Real VNC was included as part of the Raspbian Image. I do not recommend using this guide if you have the latest (>25/11/2016) Raspbian.