Connecting with a remote desktop (VNC, Debian Wheezy)

You don’t need to connect to a external monitor when the Raspberry Pi is connected to a network. You can use Virtual Network Computing by installing tightvnc on your Raspberry Pi and using the pre installed “screen sharing” on your Mac.

First you need to install tightvnc on your Pi:

pi@raspberrypi ~ $sudo apt-get install tightvncserver

and run it

pi@raspberrypi ~ $tightvncserver

If you have a Mac you need to go to the “Finder” and select “Go > Connect to Server…” or use the Shortcut “CMD + K”

type in

vnc://192.168.1.127:5901

The ip adres can differ off course. Probably 192.168.1.x The number after the “:” differs from the port that you need to connect to and the session you have started “5901“. So “1” stands for the first session created with “tightvncserver”.

And you will need to fill in the username and password for connecting to the Pi’s desktop. The default is username: “pi” and password: “raspberry”

Autostart vncserver when Raspberry Pi boots

When you have correctly installed vnc server on your Raspberry Pi you can run an autoboot script to autostart the vnc session when Raspberry Pi boots up. The first step is to run the following command:

pi@raspberrypi ~ $sudo nano /etc/init.d/tightvnc

Then copy and paste the following code into this document:

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

case "$1" in
start)
su pi -c 'vncserver :1'
echo "VNC Started"
;;
stop)
pkill Xtightvnc
echo "VNC Terminated"
;;
*)
echo "Usage: /etc/init.d/tightvnc {start|stop}"
exit 1
;;
esac

Enter ctrl+x and y to exit and save.

Set the permissions of the file to make it executable:

pi@raspberrypi ~ $sudo chmod 755 /etc/init.d/tightvnc

Update the rc.d file (which tracks which initialization scripts are in the /init.d/ folder):

pi@raspberrypi ~ $sudo update-rc.d tightvnc defaults

To test it, you need to reboot the Raspberry Pi:

pi@raspberrypi ~ $sudo reboot

Good luck!

Next up is http://www.derkbraakman.com/access-files-on-your-raspberry-pi-from-your-mac/

Leave a Reply

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

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