Pi in a time of Brexit – Remote Controlling Raspberry Pi from Ubuntu using VNC

What with Larry the Downing Street Cat and Palmerston, his counterpart at the Foreign Office, Teddy suspects he knows the real reason for the Country’s current travails.
Here he is, doing his best Boris Johnson impression :

“No wonder Brexit’s a Cat-astrophe !”

In an attempt to distract myself from the prospect of the country being ruined by this feline consipracy, I’ve been playing with my new Raspberry Pi Model 3 B-spec.
At some point, I’m going to want to connect remotely to the Desktop on the Pi. What follows is how I can do this using VNC…

Why VNC ?

Regular readers (hello Mum!) may be wondering why I’m returning to this topic, having previously used RDP to remote to a Pi.

Well, this newer model RaspberryPi is running Raspbian Stretch ( or version 9) as opposed to the older machine, which was running Jessie (version 8).
Stretch has VNC included by default so it makes sense to use this protocol for connecting to the desktop remotely.

Now, the more observant among you will notice that you can simply and easily enable VNC in the same way as you can enable SSH during initial setup.
You can see this option in the Preferences/Raspberry Pi Configuration menu when you click on the Interfaces tab :


If, like me, you don’t discover that this is the way to go until after you’ve put away all those old peripherals you had to dig out of the attic to setup your Pi then fear not, you can also do this from the command line…

On the Pi

First of all, we want to make sure that we do, in fact, have the required VNC software on the Pi.
So, once I’ve connected to the Pi via SSH, I can run this from the command line :

apt list realvnc*

…which should come back with :

Now we want to configure VNC on the pi so, on the command line we need to enter …

sudo raspi-config

This will bring up the Software Configuration Tool screen below.
Using the arrow keys on the keyboard, navigate to the line that starts 5 Interface Options and hit the [Enter] key.


…which brings up a sub-menu. Here, you need to navigate to P3 VNC and hit [Enter]


…and [Enter] again to confirm you want to enable VNC…

…before you receive a message confirming that VNC is now enabled :

To exit, hit [Enter]

I’m not sure if it’s strictly necessary, but at this point, I re-started the pi by entering :

sudo reboot

In Ubuntu

Meanwhile, on the Ubuntu machine (I’m running Ubuntu 16.04), we need to head over to the VNC Viewer download site.
As I’m on a 64-bit version of Ubuntu, I chose the DEB x64 version to download.

Incidentally, you can tell if you’re running a 32-bit or 64-bit Linux distro, you can run :

uname -i

If this returns x86_64 the you’re on a 64-bit platform.

Anyhow, when prompted, I opted to open the downloaded file – VNC-Viewer-6.19.107-Linux-x64.deb with Software Install


…which results in…


Now we simply click Install and enter our password when prompted.

Once the installation is completed we’re ready to connect remotely.

Running VNC Viewer

To start the viewer, you can simply open a Terminal and run :

vncviewer

After you’ve accepted the licence, enter the address of the server to connect to (in my case pithree) :

You’ll then be prompted to enter the username and password of a user on the Pi :


Press OK and…


You can tweak the display to make it a bit more practical.
In the VNC Window, move the cursor to the top of the screen so that the Viewer menu slides down then select the cog-wheel icon (second from the right) :

In the Options tab, set Picture Quality to High and Scaling to Scale to fit window :

After this, the VNC viewport should scale to the size of the VNC window itself.

Now all I need is to something else to distract myself from the ongoing battle between Project Fear and Project Farce.

Advertisements

Leave a Reply

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

WordPress.com Logo

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

Google photo

You are commenting using your Google 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 )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.