If you are like me, you rarely, if ever, plug a monitor and keyboard into your Raspberry Pi. Instead you run everything from a network connection. Commonly this is just a terminal and SSH connection from a desktop computer like a PC or Mac.
However, there are times when in it useful to access the Raspberry Pi Desktop and instead of reaching for the monitor, I instead reach for a tool called VNC – or Virtual Network Computer. In earlier days, you needed to install VNC on the Raspberry PI, but these days in 2020, it’s built-in. Like a lot of built-in tools you have to enable it first to use it.
I’ll describe below, how to enable VNC and connect to it from a remote computer. This whole setup can be done on the Raspberry Pi from the command line – after all, what’s the point if you couldn’t?
Enabling VNC on the Raspberry Pi #
First of all login to your Raspberry Pi over SSH. Then type the following command:
This will call up the Raspberry Pi command line version of the configuration screen which will look something like this depending on version.
Then scroll down to “Interfacing Options” and something like the following screen comes up:
Obviously the one we want here is “VNC” and then enable it.
It flashes to the command line and then returns with this screen:
Then reboot and you are good to go.
Connecting to the Raspberry Pi from another Computer #
Once you have VNC enabled in the Raspberry Pi, then you need a VNC Viewer on the computer you want to use to view the Raspberry Pi. You can download the VNC Viewer for your platform from the RealVNC website (is there a FakeVNC website somewhere?). These days they want you to create an account – don’t worry you won’t get charged for anything – and then once you have you can download and install the VNC Viewer.
To connect to the Raspberry Pi you need to know the IP Address of your Raspberry Pi. Armed with that, the following steps shows how to connect to the Raspberry Pi. The screenshots are from a Mac, but the method is the same on other platforms.
Open up VNC Viewer on your computer and type in the IP address of your Raspberry Pi.
When you first run it, you will get a message about authentication and certificate – just click OK, then you will get to the login screen:
Initially (if you haven’t changed the default raspberry pi user and password) this will be “pi”and “raspberry”. The first time you log in you will see a very compact and bijou desktop of a whopping 720 x 480. You can easily change this.
Changing the Raspberry Pi Desktop Resolution over VNC #
Cute though the initial desktop may be, it’s not very useful as a GUI. To change the resolution (and this will stick for when you next connect), go to the Raspberry Pi ->Preferences ->Raspberry Pi Configuration.
Select the display tab and “Set Resolution” and set it to something that seems sensible to you.
And then Reboot and VNC will automagically reconnect with the new resolution:
New connection and resolution :