Connecting to your Pi through VNC

Make a VNC connection to the Raspberry Pi.


The next thing I want to do is connect to the Raspberry Pi using VNC.  VNC is a remote desktop tool that lets you see the screen of a remote computer on your own screen.

Since the latest version of Raspbian it is included.  All you have to do is go the the Raspberry Pi Configuration under the Menu > Preferences option.  In the tab “Interfaces”, there should be a “VNC” option.  Make sure it is enabled.

If you’re unlucky, like me in this case, this option will be disable for some reason.  I’ve been googling this issue, but can’t seem to find a reasonable solution.

So instead, I will do it the hard way, and show you how.

The first thing to do is install a package called “tightvncserver”.  You can do that by connecting to the Pi via ssh and typing the command

sudo apt-get install tightvncserver

After installation, start the VNC server using the following command :

vncserver :1

Mind the “space” between the r and the 1.  It’s important.

You’ll be prompted to give a password.  The catch is: it’s only 8 characters.  So I chose “raspberr”.

Schermafbeelding 2017-01-06 om 20.58.37.png

You’ll have to reboot the Pi afterwards.

On my mac I downloaded VNC viewer for Raspberry Pi.  You can find it here.

Configure your connection like this :

The connection is made through the IP address followed by the :1 suffix.  Just like the suffix you started your vnc server with.

Schermafbeelding 2017-01-06 om 21.05.32.png

That should work like a charm!

Now to make sure that the VNC server is started every time the Pi boots.

That’s somewhat more difficult.

Connect to the Pi using ssh.  Change directory to the “.config” folder.

cd .config

Note that the name of the folder starts with a dot (.).  That means that it’s a hidden folder.  By default you won’t be able to see it using the “ls” command.  If it doesn’t already exist, create a directory called “autostart”, and go to it

mkdir autostart
cd autostart

Next we have to create a new file called “tightvnc.desktop”.  Do that by typing

nano tightvnc.desktop

Nano is a text editor.  By starting it this way, it will automatically create the file “tightvnc.desktop”.

Type in the following exactly :

[Desktop Entry]
Exec=vncserver :1

Get out of nano by typing ctrl-x and typing “y” and press enter to save.

That’s it. Reboot the py:

sudo reboot

After rebooting, try and connect again using VNC viewer.  That should work perfectly.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s