Sunday 16 March 2014

Setting up VNC on Raspberry Pi

Setting up a VNC server on Raspberry Pi will allow you to access the desktop remotely, similar to Windows Remote Desktop Connection (RPC). Unlike RPC, multiple VNC sessions can be run concurrently, allowing multiple users to use the same machine at once.

To set up a VNC server on Raspberry Pi, install tightvncserver

sudo apt-get install tightvncserver

Get the resolution of your screen in Windows
Right click on the desktop and click on "Screen Resolution"

Then see what the resolution of your screen is. Mine is 1600 x 900


Start a VNC session on the Raspberry Pi with the following command
vncserver -geometry 1600x900

This will ask for a password, enter the password.

Once this is done, the session will be displayed
New 'X' desktop is raspberrypi:1

The session number is 1. You can now view the desktop remotely.

To do this you will need to download a VNC viewer. I use RealVNC http://www.realvnc.com/download/viewer/

Now you will need the IP Address of your Raspberry Pi. Use the following command to get the IP Address
ifconfig | grep inet

pi@raspberrypi ~ $ ifconfig | grep inet
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet addr:192.168.1.37  Bcast:192.168.1.255  Mask:255.255.255.0

You will need to the inet addr. There will be two addresses. 127.0.0.1 and some other address. In my case, it is 192.168.1.37

Open the VNC viewer and type in the IP Address, colon, VNC session in the VNC Server field. <ipaddr>:<sessionnum>
Select the "Let VNC Server choose" option for Encryption and then click "Connect".



A warning message will be shown saying the connection is unencrypted.  Click the "Do not warn me about this for <vnc session> again" and click the continue button.


You will then be prompted for your password. Enter the password that you used when you installed tightnvc and click OK.

You will now be able to use the desktop


No comments:

Post a Comment