Raspberry Pi Server/Viewer VNC configuration

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
Raspberry Pi Server/Viewer VNC configuration
Raspberry Pi Server/Viewer VNC configuration
Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Raspberry Pi
Software VNC
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – 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.

NOTE
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

  1. To enable VNC from the desktop GUI, click on the application launcher, navigate to Preferences, and select Raspberry Pi Configuration.
    Selecting Raspberry Pi Configuration out of the desktop’s Preferences menu
    Selecting Raspberry Pi Configuration out of the desktop’s Preferences menu
  2. Next, click on the Interfaces tab, and then toggle VNC to enable it.
    Enabling VNC from the Interfaces tab
    Enabling VNC from the Interfaces tab
  3. Afterwards, VNC will be running in the task bar. You can right click on it for further configuration options.
    VNC will continue running in the background on the task bar
    VNC will continue running in the background on the task bar


Enable VNC Server via Command Line

  1. Start by opening a terminal and opening the raspi-config utility with root permissions by executing this command:
    $ sudo raspi-config
    
  2. Use the arrow keys on your keyboard to highlight ‘Interface Options’ and press Enter.
    Selecting Interface Options from the raspi-config menu
    Selecting Interface Options from the raspi-config menu
  3. 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.
    Selecting VNC out of the Interface Options menu
    Selecting VNC out of the Interface Options menu
  4. The utility will ask you to confirm that you want to enable VNC. Select ‘Yes’ to proceed with enabling it.

    Enabling VNC from the raspi-config utility menu
    Enabling VNC from the raspi-config utility menu



  5. 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.
    Confirmation dialog that VNC has been enabled on the Raspberry Pi
    Confirmation dialog that VNC has been enabled on 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.

  1. 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
    
  2. After installation, open the TigerVNC Viewer by navigating to the application launcher > Internet > TigerVNC Viewer.
    Opening TigerVNC Viewer on the Raspberry Pi
    Opening TigerVNC Viewer on the Raspberry Pi
  3. 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.



    Connecting to a remote system via TigerVNC on the Raspberry Pi
    Connecting to a remote system via TigerVNC on the Raspberry Pi

Closing Thoughts

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.



Comments and Discussions
Linux Forum