If you plan to remotely administer your Raspberry Pi, then using VNC is one of the most effective ways to do so when it comes to remote desktop applications. VNC allows you to use another device to connect to the Raspberry Pi, and use your mouse and keyboard as if they were physically plugged into the device itself. The reverse is also possible, meaning that the Raspberry Pi can be used as the client device and connect to other computers remotely.
In this tutorial, you will learn how to set up VNC on the Raspberry Pi and use it as both a server and client. Setting up the Raspberry Pi as a VNC server means that other devices can remotely connect to it. On the other hand, being a VNC client allows the Raspberry Pi to connect to and remotely control other systems. Of course, it is also possible to configure the device as both a VNC client and server simultaneously. Follow along with the steps below to learn how.
In this tutorial you will learn:
- How to enable VNC Server via command line and GUI
- How to install and use VNC Client on Raspberry Pi
|Requirements, Conventions or Software Version Used
|Privileged access to your Linux system as root or via the
# – requires given linux commands to be executed with root privileges either directly as a root user or by use of
$ – requires given linux commands to be executed as a regular non-privileged user
Configure VNC Server on Raspberry Pi
First, we will cover how to enable VNC server on the Raspberry Pi. This will allow you to remotely connect to the Raspberry Pi and use it like you would an ordinary desktop PC. We will cover two methods below, both command line and GUI. If you are currently connected to the Raspberry Pi via SSH or just prefer the command line, then we will use the raspi-config utility. Otherwise, desktop users can enable VNC from the preferences menu. Follow along below to see how.
VNC allows remote desktop connections. If you would like to administer your Raspberry Pi via command line instead of GUI, then it is possible to set up an SSH server on the Raspberry Pi.
Enable VNC Server via GUI
- To enable VNC from the desktop GUI, click on the application launcher, navigate to Preferences, and select Raspberry Pi Configuration.
- Next, click on the Interfaces tab, and then toggle VNC to enable it.
- Afterwards, VNC will be running in the task bar. You can right click on it for further configuration options.
Enable VNC Server via Command Line
- Start by opening a terminal and opening the
raspi-configutility with root permissions by executing this command:
$ sudo raspi-config
- Use the arrow keys on your keyboard to highlight ‘Interface Options’ and press
- On the next menu, we have several different options for technologies we can enable or disable. Move down to the ‘VNC’ option and select it.
- The utility will ask you to confirm that you want to enable VNC. Select ‘Yes’ to proceed with enabling it.
- If successful, the utility will let you know that the VNC server is now enabled. The changes will take effect right away and you can now use VNC to remotely control the Raspberry Pi.
Using Raspberry Pi as a VNC Client
In the previous section, we enabled VNC server on the Raspberry Pi. This is well and good for situations where we want to use another device to remotely connect to the Raspberry Pi. But what if we want to use the Raspberry Pi in order to connect to other devices? In that case, we would be using the Raspberry Pi as a VNC client. Let’s see how to do that.
- In case it is not already installed, run the following command to install the TigerVNC viewer application. This is a free and open source VNC viewer that we can safely recommend, although others also exist and can be installed alternatively.
$ sudo apt update $ sudo apt install tigervnc-viewer
- After installation, open the TigerVNC Viewer by navigating to the application launcher > Internet > TigerVNC Viewer.
- In the TigerVNC Viewer window, enter the information of the remote system that you wish to connect to. This will be the hostname, fully qualified domain name, or IP address of the remote system. As long as the VNC service is running on the remote system, you have permission to access it, and there are no other devices such as a firewall blocking connections, you will be able to connect successfully.
In this tutorial, we saw how to enable and configure VNC server and VNC client on a Raspberry Pi system. This allows users to administer their Pi device from another computer or even mobile phone. The reverse is also true, where we can use the Raspberry Pi as a means to connect to other devices on our local network or across the internet.