Installing VNC on Raspberry Pi

To configure your Raspberry Pi to support VNC, following these steps:

1) Cable Raspberry Pi:

Physically connect the Raspberry Pi to your network using the wired connection.

Raspberry Pi

2) IP address discovery:

Find out the IP address of the Raspberry Pi. In this case, my local BT DSL router is set up as a DHCP server and is allocating IP addresses as follows.

BT-home-hub

Or, if you have a monitor connected to the Raspberry PI, open a terminal window and then type “ifconfig”:

pi@pi2 ~ $ ifconfig
eth0      Link encap:Ethernet  HWaddr b8:27:eb:fe:f6:13
          inet addr:192.168.56.79  Bcast:192.168.56.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:68405 errors:0 dropped:0 overruns:0 frame:0
          TX packets:52431 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:54025084 (51.5 MiB)  TX bytes:33837120 (32.2 MiB)

eth0:0    Link encap:Ethernet  HWaddr b8:27:eb:fe:f6:13
          inet addr:10.10.10.1  Bcast:10.10.10.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:39166 errors:0 dropped:0 overruns:0 frame:0
          TX packets:39166 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:63000560 (60.0 MiB)  TX bytes:63000560 (60.0 MiB)

pi@pi2 ~ $

3) SSH to Raspberry Pi:

If connecting across the network, download putty and then open a SSH session to the Raspberry PI:

putty configuration

4) Install tight VNC Server:

To install tight VNC Server, do the following:

pi@pi2 ~ $ sudo apt-get install tightvncserver
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  x11-xserver-utils xfonts-base
Suggested packages:
  tightvnc-java nickle cairo-5c xorg-docs-core
The following NEW packages will be installed:
  tightvncserver x11-xserver-utils xfonts-base
0 upgraded, 3 newly installed, 0 to remove and 205 not upgraded.
Need to get 7,148 kB of archives.
After this operation, 10.4 MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://mirrordirector.raspbian.org/raspbian/ wheezy/main tightvncserver armhf 1.3.9-6.4 [786 kB]
Get:2 http://mirrordirector.raspbian.org/raspbian/ wheezy/main x11-xserver-utils armhf 7.7~3 [181 kB]
Get:3 http://mirrordirector.raspbian.org/raspbian/ wheezy/main xfonts-base all 1:1.0.3 [6,181 kB]
Fetched 7,148 kB in 9s (737 kB/s)
Selecting previously unselected package tightvncserver.
(Reading database ... 59216 files and directories currently installed.)
Unpacking tightvncserver (from .../tightvncserver_1.3.9-6.4_armhf.deb) ...
Selecting previously unselected package x11-xserver-utils.
Unpacking x11-xserver-utils (from .../x11-xserver-utils_7.7~3_armhf.deb) ...
Selecting previously unselected package xfonts-base.
Unpacking xfonts-base (from .../xfonts-base_1%3a1.0.3_all.deb) ...
Processing triggers for man-db ...
Processing triggers for menu ...
Processing triggers for fontconfig ...
Setting up tightvncserver (1.3.9-6.4) ...
update-alternatives: using /usr/bin/tightvncserver to provide /usr/bin/vncserver (vncserver) in auto mode
update-alternatives: using /usr/bin/Xtightvnc to provide /usr/bin/Xvnc (Xvnc) in auto mode
update-alternatives: using /usr/bin/tightvncpasswd to provide /usr/bin/vncpasswd (vncpasswd) in auto mode
Setting up x11-xserver-utils (7.7~3) ...
Setting up xfonts-base (1:1.0.3) ...
Processing triggers for menu ...
pi@pi2 ~ $

5) Start VNC Server:

To start the VNC server, use the following command. The “:0? option specifies the port number to use within VNC. The “-geometry” option specifies the resolution.

pi@pi2 ~ $ vncserver :1 -geometry 1920x1080 -depth 24

You will require a password to access your desktops.

Password:
Verify:
Would you like to enter a view-only password (y/n)? n

New 'X' desktop is pi2:1

Creating default startup script /home/pi/.vnc/xstartup
Starting applications specified in /home/pi/.vnc/xstartup
Log file is /home/pi/.vnc/pi2:1.log

pi@pi2 ~ $

6) Connect via a VNC Viewer:

The VNC Server has now started. Download a VNC viewer such as UltraVNC Viewer or others and then connect using the Raspberry Pi IP address and port specified (in this case 1):

vnc-viewers-ultra-VNC

7) Accept warning (if shown):

vnc-unecrypted-connection

8) Enter password and click ok:

vnc-viewer-authentication

9) Connection success:

pis-x-desktop-pi-vnc-viewer

All the best!
David Bombal



Tags: ,


About :

These days I am involved in some exciting SDN and OpenFlow projects involving the HP VAN SDN Controller, HP ProVision and HP Comware switches. These new developments in the networking world combine my passions of networking and application development. I hope to write some interesting blog entries on these exiting topics. I am both a Cisco CCIE #11023 and HP MASE as well as a Cisco Certified Systems Instructor (CCSI #22787) and Certified HP Instructor. I have been training networking courses for well over 10 years teaching on a wide range of topics including routing and switching, VoIP, OpenFlow and SDN. I have delivered instructor led courses all over the world. I started working with Cisco Unified Communications Manager when it was still called Cisco Call Manager and have been deploying, troubleshooting and teaching Unified Communications products since version 3.0. I have developed various network utilities such as the VPN Config Generator and others to help engineers in their day to day jobs. I also develop software, training materials, EBooks, videos and other products which are used throughout the world. I have designed, implemented and managed networks ranging from single sites to those that span 50 countries.

View all posts by


No comments yet.

Leave a Reply

  • Proper format "info@pakiti.com"