Login

How to Install VNC Server on Raspberry Pi: Step-by-Step Guide

Introduction: Install VNC Server on Raspberry Pi

Remotely accessing a Raspberry Pi through its desktop graphical interface can dramatically expand your project’s flexibility. VNC (Virtual Network Computing) lets you view and control your Pi from anywhere on the same network (and even across the internet, if properly configured). In this comprehensive, you’ll learn how to install VNC Server on Raspberry Pi, configure it securely, and connect from Windows, Mac, or mobile devices.

What is VNC and Why Use It on Raspberry Pi?

When you install VNC Server on Raspberry Pi, you unlock remote desktop capabilities that let you you see your Raspberry Pi’s desktop on another computer or mobile device, perfect for headless setups or operating your Pi from afar. VNC is especially valuable for:

  • Remote troubleshooting and system administration
  • Working without a physical monitor, keyboard, or mouse
  • Demonstrating or teaching with Raspberry Pi
  • Projects requiring unattended, secure, or cloud-based access

Prerequisites: What You’ll Need

  • Raspberry Pi (any model running Raspberry Pi OS)
  • Network connection (Ethernet or Wi-Fi)
  • Up-to-date Raspberry Pi OS (ensure latest patches and repositories)
  • (Optional) A monitor/keyboard/mouse for first setup, or SSH terminal access

Step 1: Update Raspberry Pi OS

Before installing anything, make sure your Pi OS is fully updated—this avoids conflicts and ensures package compatibility:

bashsudo apt update
sudo apt upgrade
sudo apt full-upgrade

Step 2: Install RealVNC VNC Server

The simplest way to install VNC Server on Raspberry Pi OS is via the terminal using apt commands.

bashsudo apt install realvnc-vnc-server realvnc-vnc-viewer

The realvnc-vnc-viewer package allows your Pi to connect out to other VNC servers (optional if you only wish to connect to the Pi itself).

Step 3: Enable VNC Server

VNC Server must be enabled before it accepts connections. Two ways:

Graphical Interface (Desktop)

  1. Menu → Preferences → Raspberry Pi Configuration.
  2. Go to the “Interfaces” tab.
  3. Find “VNC” and set to Enabled.
  4. Click OK.

Command Line (Headless/SSH)

bashsudo raspi-config
  • Use arrow keys: select Interface Options > VNC.
  • Choose Yes to enable.
  • Tab to “Finish” and exit.
  • (Optional but recommended) Reboot the Pi:
bashsudo reboot

Step 4: Configure Server (and Display Issues)

For Raspberry Pi OS Bookworm or Raspberry Pi 5

Newer models and Raspberry Pi OS releases (like Bookworm/Debian 12) default to a display manager called Wayland, which may not yet be fully compatible with RealVNC. For best results:

  • Enter sudo raspi-config
  • Go to Advanced Options → Wayland
  • Select X11 (the older display manager)
  • Reboot when prompted

This ensures you do not get a blank or non-responsive VNC screen.

Step 5: Find the Raspberry Pi’s IP Address

  • Open a terminal and type:
bashhostname -I
  • Note the displayed IP address, this is what you’ll use to connect your VNC viewer.

After you install VNC Server on Raspberry Pi and enable it, connecting via VNC Viewer is straightforward.

Step 6: Connect Using VNC Viewer

On your laptop, PC, or phone, install the free RealVNC Viewer (recommended for best security/performance):

  • Download from the official RealVNC website
  • Open VNC Viewer and enter the Pi’s IP address (e.g., 192.168.1.10)
  • Log in with your Raspberry Pi credentials (default username: pi, password as set)

You will instantly be presented with your Pi’s desktop GUI, which you can control as if you’re physically in front of the device.

Best Practices for a Secure and Optimized VNC Setup

  • Change the default password for the ‘pi’ user (never use the default for VNC/SSH)
  • Limit VNC access via your local network, or set up a secure VPN for access across the internet
  • Use strong, unique credentials and consider key-based authentication for SSH/VNC
  • Update and patch your Raspberry Pi OS regularly
  • For internet access, consider VNC Connect’s cloud feature or ports/Tunnel services (but always choose secure options and know the risks)

Troubleshooting Common Issues

  • Blank Screen on Connection? Switch from Wayland to X11 as detailed above.
  • Can’t connect? Ensure your Pi and your connecting device are on the same network, VNC is enabled, and the firewall/router isn’t blocking port 5900.
  • Certificate Warnings? For local/home use, these can usually be safely bypassed, but always verify on critical networks.

Recap Table: Key Steps to Install VNC Server on Raspberry Pi

Step Command/Setting Details
Update OS sudo apt update && sudo apt upgrade Keeps Pi secure and compatible
Install RealVNC sudo apt install realvnc-vnc-server Installs official VNC package
Enable VNC GUI: Interfaces tab → VNC Enabled Or: sudo raspi-config → Interface
(If blank screen) Use X11 sudo raspi-config → Advanced → Wayland → X11 For Bookworm and Pi 5 compatibility
Find IP Address hostname -I Use for VNC Viewer
Connect on PC/phone Install VNC Viewer, enter IP, authenticate Access desktop remotely

FAQs: Install VNC Server Raspberry Pi

1. How do I install VNC Server on Raspberry Pi?
To install VNC Server on Raspberry Pi, first update your OS using sudo apt update && sudo apt upgrade. Then run:

sudo apt install realvnc-vnc-server realvnc-vnc-viewer

After installation, enable it via Raspberry Pi Configuration → Interfaces → VNC → Enable or using sudo raspi-config. Finally, reboot your Pi and connect with RealVNC Viewer using your Pi’s IP address.

2. Is VNC pre-installed on Raspberry Pi OS?
Yes, in most recent Raspberry Pi OS versions (with desktop), RealVNC Server is pre-installed but not enabled by default. If you cannot find it, you can manually install VNC Server on Raspberry Pi using the terminal.

3. Can I install VNC Server on Raspberry Pi without a monitor?
Yes. If you are running your Raspberry Pi headless, you can install and enable VNC Server via SSH. After logging in through SSH, run the install commands and enable VNC with sudo raspi-config. Once done, you can connect from another computer using VNC Viewer.

4. Which is better for Raspberry Pi remote access: VNC or SSH?
It depends on your use case. If you install VNC Server on Raspberry Pi, you get a full graphical desktop environment accessible remotely. SSH, on the other hand, provides command-line access and is faster and lighter. Many users combine both—using SSH for system administration and VNC for GUI-based tasks.

5. Why do I get a blank screen after I install VNC Server on Raspberry Pi?
This usually happens because Raspberry Pi OS Bookworm and newer versions use Wayland display manager, which isn’t fully supported by RealVNC yet. The fix is to switch to X11:

sudo raspi-config → Advanced Options → Wayland → Select X11

Reboot, and the blank screen issue should be resolved.

6. Can I use VNC over the internet with Raspberry Pi?
Yes, but it requires extra security measures. After you install VNC Server on Raspberry Pi, you can use RealVNC’s VNC Connect Cloud feature, a VPN, or port forwarding. The safest option is using a VPN or VNC Connect Cloud since they encrypt your session and protect against open port risks.

7. What port does VNC use on Raspberry Pi?
By default, VNC Server listens on port 5900. If you install VNC Server on Raspberry Pi and run multiple displays, each one will use incremental ports (e.g., 5901, 5902). Make sure your firewall or router allows this port for proper connectivity.

8. Can I install VNC Server on Raspberry Pi 5 / Raspberry Pi Zero?
Yes, VNC Server can be installed on all Raspberry Pi models, including Raspberry Pi 5, Raspberry Pi 4, and Raspberry Pi Zero. Just ensure you’re running the latest Raspberry Pi OS and apply the same installation steps. On Raspberry Pi 5, switching from Wayland to X11 is recommended for compatibility.

Final Thoughts

Installing a VNC server on a Raspberry Pi is fast, simple, and opens doors to remote desktop, support, and even full UI project control. With just a few commands and good security practices, you can harness the full remote management capabilities of your Pi, making it ideal for makers, IoT projects, education, or entertainment.

Sarang Khedkar

How to Install VNC Server on Raspberry Pi: Step-by-Step Guide
Table of Contents
    ×