12

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

 3 years ago
source link: https://mikesmithers.wordpress.com/2019/01/27/pi-in-a-time-of-brexit-remote-controlling-raspberry-pi-from-ubuntu-using-vnc/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

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

Posted on January 27, 2019

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 :

teddy_boris.jpg?w=584&h=438

“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 :

initial_preferences.png?w=584

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 :

realvnc_packages.png?w=584&h=126

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.

raspi_config.png?w=584&h=347

…which brings up a sub-menu. Here, you need to navigate to P3 VNC and hit [Enter]
raspi_config_vnc.png?w=584&h=347

…and [Enter] again to confirm you want to enable VNC…
vnc_confirm.png?w=584&h=347

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

vnc_enabled.png?w=584&h=347

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

download_file.png?w=584

…which results in…
vnc_install1.png?w=584&h=389

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) :

vnc_first_connect.png?w=584&h=433

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

vnc_login.png?w=584

Press OK and…
pi_desktop_vnc.png?w=584&h=438

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) :
top_menu.png?w=584&h=332

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

scaling.png?w=584

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.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK