RPi VNC Server

Back to RPi Guides.

Raspberry Pi VNC Server

=What does it do?=

Sometimes it is not convenient to work directly on the raspberry pi. Maybe it just has one screen and you are used to a multi-screen setup. This tutorial shows how you can view the raspberry pi graphical session in on your regular desktop in a window.

=What do you need?=


 * A Raspberry Pi, model B.
 * A boot SD card for the Raspberry Pi.
 * A network connection (Ethernet or WiFi).

=What skill level is required?=

This project does not require any coding or compilation. Very basic Linux and networking knowledge would be useful, but not essential.

You need to...
 * Install software
 * Enter basic Linux commands
 * Use standard software tools (Windows/Linux/Mac) to add software to your PC
 * Connect computers using ethernet cables

=How does it work?=

The commands described below start "virtual" graphical session. Instead of using a hardware framebuffer, this uses RAM for a framebuffer. It also opens a port that allows programs on other computers (if they provide the password) to show the framebuffer and provide mouse and keyboard events.

This way you can run a session on the raspberry pi, but display elsewhere.

Because the framebuffer isn't the real framebuffer you cannot take advantage of the GPU to accelerate operations on the screen.

=Overview of this project= You need to
 * Install a VNC server on the Raspberry Pi
 * Start the VNC server
 * Install a VNC client on another computer

=Instructions= Log in to your Pi and install the Tight VNC Package $ sudo apt-get install tightvncserver Next Run TightVNC Server which will prompt you to enter a Password and an optional View Only Password $ tightvncserver Once that is done you can run it straight from the prompt I am using 1920x1080 which is my monitor maximum resolution. $ vncserver :1 -geometry 1920x1080 -depth 24 Or you could create a script to save typing in the whole thing. $ nano svnc.sh (call the file whatever you like) Add the lines: vncserver :1 -geometry 1920x1080 -depth 24 Ctrl-x y (To Exit Nano and Save)
 * 1) !/bin/sh

Set the file to Execute $ chmod +x svnc.sh then to run $ ./svnc.sh

Run at boot.

Start a root session sudo bash

Create a file in /etc/init.d with a suitable name such as vncboot with the following content. USER=root HOME=/root export USER HOME case "$1" in start)    echo "Starting VNC Server"    #Insert your favoured settings for a VNC session    /usr/bin/vncserver :1 -geometry 1280x800 -depth 16 -pixelformat rgb565    ;;  stop) echo "Stopping VNC Server" /usr/bin/vncserver -kill :1 ;; *)    echo "Usage: /etc/init.d/vncboot {start|stop}"    exit 1    ;; esac exit 0
 * 1) BEGIN INIT INFO
 * 2) Provides:          vncboot
 * 3) Required-Start:    $remote_fs $syslog
 * 4) Required-Stop:     $remote_fs $syslog
 * 5) Default-Start:     2 3 4 5
 * 6) Default-Stop:      0 1 6
 * 7) Short-Description: Start VNC Server at boot time
 * 8) Description:       Start VNC Server at boot time.
 * 9) END INIT INFO
 * 1) ! /bin/sh
 * 2) /etc/init.d/vncboot

Modify the file permissions so it can be executed chmod 755 /etc/init.d/vncboot

Enable dependency based boot sequencing update-rc.d /etc/init.d/vncboot defaults

If enabling dependency based boot sequencing was successful, it says update-rc.d: using dependency based boot sequencing

But if it says update-rc.d: error: unable to read /etc/init.d//etc/init.d/vncboot then try the following command update-rc.d vncboot defaults

Reboot your Raspberry PI and you should find a vncserver already started.

Install Tight VNC on your desktop from the link below or most VNC clients work I believe. http://www.tightvnc.com/download.php

Or install it using your package manager. The following works on my ubuntu 11.10 workstation sudo apt-get install xtightvncviewer

Then use :1 (e.g. 192.168.1.2:1) as the host name when connecting.

Works Great, select full screen from the tool bar and a full 1080p 24bit desktop is yours from anywhere.