Introduction: Setting Up a Vnc Server (Raspbian)

This is a beginner level project for anyone who may want to utilize the full power of the raspbian Graphical environment without having to spare a separate monitor, mouse or keyboard.

As this is a beginner project I will try my level best to make it easily understandable and follow-able.

the bash script is indented so that it is easy to pick out

But since this is my first instructable I would highly appreciate any critical review of the instructable in the comments. :)

Step 1: Apparatus Required

1. Raspberry pi 2(It might work for 1 but i tested it on 2)

2.Ethernet cable / compatible WiFi dongle

3.Power supply for the raspberry pi(micro-usb)

4. SD card configured with raspbian os (https://www.raspberrypi.org/downloads/raspbian/ )

5.A windows computer (i have not worked with a mac so can't tell you how it works there)

last but not the least,as for any project big or small, patience and resilience to failure.

Step 2: Software Required

1. tightvnc ( http://www.tightvnc.com/download/2.7.10/tightvnc-2... )

you can use any other vnc viewer but i will be using this one.

2.putty for ssh-ing into the pi (if u can't use external monitor and perpherals)( http://the.earth.li/~sgtatham/putty/latest/x86/putty.exe )

Step 3: Pre-requisites

1.A fully configured network connection(basically internet for pi) with static IP for the pi

2.Raspbian OS

3.knowledge of ssh on raspberry pi if u do not have a monitor to spare.

if u have a problem achieving any of these let me know and i shall try to make tutorials on that too.

Step 4: Setting the Pi Up

ssh into the pi or open terminal in raspbian os

type the following code

sudo apt-get install tightvncserver

this will download vnc server for pi .Press 'y' when it prompts for install

then type

tightvncserver

setup up the server with password (keep the pass the same as that of your pi and help your memory out)

then type

vncserver :0

now u have opened up port 0 for vnc purposes

Step 5: Access From Computer

open tightvnc viewer and enter the IP address of your pi followed by :(colon) and then the port number

if u followed this instructable then the port number is 0.

login as pi( if default ,if u changed it then u know enough to know what to type ;)

the password is the one u set up in the last step.

if all goes well u officially have VNC access to the pi

Step 6: Now to Teach the Pi to Do This Automatically

now that u have vnc access I suggest u open this webpage inside the pi since there is a LOT of bash script if u are copying the code

Create a file containing the following shell script (use leafpad if nano scares you):

#!/bin/sh
vncserver :0 -geometry 1920x1080 -depth 24 -dpi 96

Save this as vnc.sh (for example)

to make the file executable:

chmod +x <file path of vnc.sh>

Then you can run it at any time with:.

/vnc.sh

Step 7: To Run This at Boot

to log into a terminal on the Pi as root:

sudo su

then navigate to the directory /etc/init.d/:

cd /etc/init.d/

to create a new file here using nano:

nano vncboot

this opens up the nano ui

open the file vncboot.txt and copy everything to the nano ui

press ^X(Ctrl + x) to exit

press 'y' to save the file

this saves the file as vncboot.

to make this file executable:

chmod 755 vncboot

to enable dependency-based boot sequencing(to put the file in the boot file:

update-rc.d /etc/init.d/vncboot defaults

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

update-rc.d: using dependency based boot sequencing

But if you see this:

update-rc.d: error: unable to read /etc/init.d//etc/init.d/vncboot

then try the following command:

update-rc.d vncboot defaults

This should complete your vnc setup.

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

Step 8: Test

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

if it didn't just comment your problem

we will try to fix it together!!!

Step 9: This the End

thank for your time and patience for going through this complete instructable

i hope this was beneficial to you or at least that i didn't bore you.

a bonis ad meliora

Raspberry Pi Contest

Participated in the
Raspberry Pi Contest