Getting Started With VNC on Raspberry Pi: A Complete Guide

VNC (Virtual Network Computing) is a popular remote desktop protocol that allows users to access and control a remote computer over the internet. It is a great way to access your Raspberry Pi from anywhere in the world. In this guide, we will show you how to set up VNC on your Raspberry Pi and how to connect to it securely over the internet.

1. Install VNC Server on Raspberry Pi

The first step is to install the VNC server on your Raspberry Pi. To do this, open a terminal window and type the following command:

sudo apt-get install tightvncserver

This will install the VNC server on your Raspberry Pi.

2. Configure VNC Server

Once the VNC server is installed, you need to configure it. To do this, type the following command in the terminal window:

vncserver :1

This will start the VNC server on display :1. You will be asked to enter a password for the VNC server. Make sure to choose a secure password.

3. Connect to VNC Server

Now that the VNC server is running, you can connect to it from any computer or device with a VNC client. To do this, you will need the IP address of your Raspberry Pi. To find this, type the following command in the terminal window:

hostname -I

This will display the IP address of your Raspberry Pi.

Once you have the IP address, you can connect to the VNC server using any VNC client. For example, if you are using a Windows computer, you can use the RealVNC Viewer.

4. Secure VNC Connection

By default, VNC connections are not secure. To make your connection more secure, you can use SSH tunneling. To do this, you will need to install the SSH server on your Raspberry Pi. To do this, type the following command in the terminal window:

sudo apt-get install openssh-server

Once the SSH server is installed, you can use an SSH tunnel to connect to the VNC server. To do this, you will need to use a SSH client such as PuTTY.

5. Access VNC Server Remotely

Once you have set up the VNC server and secured the connection, you can access it remotely from anywhere in the world. To do this, you will need to set up port forwarding on your router. This will allow you to access the VNC server from the internet.

To set up port forwarding, you will need to log into your router’s web interface. Once you are logged in, you will need to find the port forwarding section and add a new rule. The rule should forward port 5900 (the default VNC port) to the IP address of your Raspberry Pi.

Once you have set up port forwarding, you can access the VNC server from anywhere in the world. Just use the public IP address of your router to connect to the VNC server.

Conclusion

VNC is a great way to access your Raspberry Pi from anywhere in the world. In this guide, we have shown you how to set up VNC on your Raspberry Pi and how to connect to it securely over the internet. We have also shown you how to set up port forwarding on your router so that you can access the VNC server from anywhere.

VNC is a tool that allows you to get access to the remote desktop environment from another computer. On Raspberry Pi, using VNC is one of the easiest ways to remotely access it. If you use Raspberry Pi OS, VNC is preinstalled so you only have to enable it to get started. Let’s learn how to use it.

The first step is to enable VNC on Raspberry Pi OS (via the system configuration or raspi-config), then install the client on a computer, and type the IP address of the Raspberry Pi to get connected to it.

But don’t worry, I’ll explain all these steps in detail, so you won’t fail. You are in the right place – just keep reading to learn everything about VNC on Raspberry Pi.

If you’re looking to quickly progress on Raspberry Pi, you can check out my e-book here. It’s a 30-day challenge where you learn one new thing every day until you become a Raspberry Pi expert. The first third of the book teaches you the basics, but the following chapters include projects you can try on your own.

Enable the VNC server on your Raspberry Pi

Depending on the operating system and version you use, enabling VNC on your Raspberry Pi might be slightly different. Let’s start by making sure it’s enabled on your system.

On Raspberry Pi OS

If you have Raspberry Pi OS installed on your Pi, it will be straightforward, as VNC is pre-installed on any version so you’ll have to enable it to use it (it’s disabled by default, for security reasons).

From the desktop environment

If you can get access to the desktop environment of your Raspberry Pi, here are the steps to enable VNC:

  • Open the main menu.
  • Go to Preferences > Raspberry Pi Configuration.
  • In the Interfaces tab, find the line about VNC:
  • The interface can be slightly different depending on your version, but basically, it’s just a checkbox to enable it.
  • Once done, click on “OK” to apply the changes.

A few seconds later, VNC is enabled (you’ll see a VNC icon in the top-right corner) and you can move to the next part to install VNC on your computer.

With raspi-config

If you don’t have access to the full interface currently (for example if you are using SSH, or don’t have a keyboard/mouse on the Pi), you can use raspi-config instead:

  • Open a session on the Raspberry Pi, and get to the command line.
    You can also use the terminal app on the desktop if you want, even if there is no real reason to do this instead of the previous method.
  • Type the command:
    sudo raspi-config
  • Go to the Interfaces submenu and choose VNC:
  • Confirm that you want to enable it.
  • Quit raspi-config.

After doing this, VNC is enabled right away, and you can start using it (scroll to the VNC client installation part of this tutorial).

On other systems

Just a quick word about the other systems. Raspberry Pi can run with many alternatives to Raspberry Pi OS (check my favorites here). It’s possible to use VNC on almost all of them, but the procedure is not as straightforward.

Real VNC (the tool we’ll use later), is not completely free. It works fine on Raspberry Pi OS, but it will ask for a license when used with most other distributions. A few alternatives are available that should work in a similar way.

I tried this, but unsuccessfully on Ubuntu.

What I recommend is to use the package manager on your distribution and search for any VNC package included in the default repository. Something like:
sudo apt search vnc

If you can find a server package for VNC, use the same app on your computer. For example, on Ubuntu and Manjaro, you can easily install TightVNC on the Raspberry Pi and install TightVNC viewer on your computer to access it.

TigerVNC is another alternative you can try, especially for Red Hat and Arch-based distributions.

The protocol and apps are similar, but they are generally not compatible with one another. So make sure to use the same client as your server in the next steps.

Install the VNC client on your computer

Once the server part is installed and enabled on the Raspberry Pi, we can switch to the computer. We just need to install the VNC viewer app to remote access the Raspberry Pi from there.

On Windows

If, like most RaspberryTips visitors, you are using Windows on your computer, follow this procedure:

  • Download the installer from the official RealVNC website.
  • Double-click on the download file and follow the instructions to install it on your computer.
  • After a few seconds, the VNC client will be available in your Start menu.

On Linux

On Linux, the easiest way I found was to install the RealVNC client (in theory you can also use Remmina for VNC, but it didn’t work for me).
So, I recommend downloading the RealVNC viewer here.

Choose “Standalone” if you’ll only use it once, but I recommend choosing the .deb or the .rpm according to your distribution, to have RealVNC installed with a shortcut in the programs.

In most cases, you can install it by double-clicking on the file:

But if necessary, you can do it on the command line, for example:

  • Debian like:
    sudo dpkg -i VNC-Viewer-6.22.515-Linux-x64.deb
  • Redhat like :
    sudo rpm -ihv VNC-Viewer-6.22.515-Linux-x64.rpm

Note: You can also install VNC viewer on macOS, or even on your smartphone (iOS or Android). The procedure is similar, you can get the app from the download page linked previously.

Use VNC to control your Raspberry Pi remotely

Once the VNC viewer is installed on your computer, you can enter the IP address of the Raspberry Pi, type your login and password and get access to the full interface remotely.

Let’s learn how to do this.

Find the Raspberry Pi IP address

Before anything else, you need the Raspberry Pi IP address.
If you don’t know what I’m talking about, I recommend reading this article first, where I explain everything and different methods to find it.

But the short version is that you can hover the network icon in the top-right corner, or use the following command to get it:
ip a

The format of the IP address is something like AAA.BBB.CCC.DDD. On my screenshot, it’s 192.168.222.8 for example.

Create a new connection

You can then open the VNC viewer to create a new connection.
The interface will be slightly different depending on your operating system (and also if you are using RealVNC or not), but basically, the steps are:

  • Open VNC viewer.
  • Create a new connection (File > New connection).
    On Windows, you can also directly type the IP address in the top bar:
  • Fill out the form with the Raspberry Pi IP address you got at the last step.
  • Add a friendly name if you like, especially if you have several Raspberry Pi on your network.
  • Click on “OK” to save the connection in your favorites.

Over time, you’ll get a shortcut to each Raspberry Pi (or IP address) you ever used just under the menu:

Start the connection

Then, you can simply start the connection by double-clicking on the shortcut.

For the first time, you may have a security warning to accept (the connection is not encrypted with VNC).
You’ll also need to provide the username and password you want to use. You can use the system users for this, so it’s the same as when you sign in on Raspberry Pi OS directly.

And that’s it. After that, you’ll get access to the full desktop environment of your Raspberry Pi, and can do whatever you want from the comfort of your main computer.
Check the following part if you experience any issues, I answer the most common questions.

Want to chat with other Raspberry Pi enthusiasts? Join the community, share your current projects and ask for help directly in the forums.

Related questions

How to fix the error: “Cannot currently show the desktop” with VNC?

Raspberry Pi OS doesn’t start the desktop environment if there is no HDMI cable plugged into the Raspberry Pi. If you boot without plugging one and try to access it via VNC, you’ll get this error: “Cannot currently show the desktop”.

To fix this, keep a monitor plugged in all the time, or start VNC manually via SSH with:
vncserver
You may need to specify a different port after that, for example: IP_ADDRESS:1 instead of IP_ADDRESS.
The port is mentioned in the command output:

How to change the default resolution in VNC?

When a monitor is plugged in, the VNC server will start with the corresponding resolution. But it’s not always ideal, especially if you have a small screen on it, but a bigger screen on your computer.

To fix this, you can go to the system configuration and change the “Headless resolution” in the “Display” tab. You have the same thing in raspi-config, under “Display options” > “VNC resolution”.

Another thing you can try is to change the options on the VNC viewer. In the advanced settings for the connection, there is a list where you can choose to adjust the resolution to the window or use a percentage (scaling).

What’s the default username and password for VNC?

The username and password for a VNC connection are the same as for a desktop connection. On an old Raspberry Pi OS version, it might be “pi” and “raspberry” for example. Or the user you created on the first boot in other cases.

If needed, you can check my other tutorials on how to recover a lost password, or how to create new users on Raspberry Pi.

Additional Resources

Not sure where to start?
Understand everything about the Raspberry Pi, stop searching for help all the time, and finally enjoy completing your projects.
Watch the Raspberry Pi Bootcamp course now.

Master your Raspberry Pi in 30 days
Don’t want the basic stuff only? If you are looking for the best tips to become an expert on Raspberry Pi, this book is for you. Learn useful Linux skills and practice multiple projects with step-by-step guides.
Download the e-book.

VIP Community
If you just want to hang out with me and other Raspberry Pi fans, you can also join the community. I share exclusive tutorials and behind-the-scenes content there. Premium members can also visit the website without ads.
More details here.

Need help building something with Python?
Create, understand, and improve any Python script for your Raspberry Pi.
Learn the essentials step-by-step without losing time understanding useless concepts.
Get the e-book now.

You can also find all my recommendations for tools and hardware on this page.

Getting Started With VNC on Raspberry Pi: A Complete Guide

VNC (Virtual Network Computing) is a great way to access your Raspberry Pi remotely. It allows you to control your Raspberry Pi from any computer or device with an internet connection. In this guide, we’ll show you how to get started with VNC on your Raspberry Pi.

What is VNC?

VNC is a remote desktop protocol that allows you to control your Raspberry Pi from any computer or device with an internet connection. It’s a great way to access your Raspberry Pi from anywhere in the world. With VNC, you can control your Raspberry Pi’s desktop, open applications, and transfer files.

How to Set Up VNC on Raspberry Pi

Setting up VNC on your Raspberry Pi is easy. Here’s what you need to do:

  • Install the VNC Server software on your Raspberry Pi.
  • Configure the VNC Server software.
  • Install the VNC Viewer software on the computer or device you want to use to access your Raspberry Pi.
  • Connect to your Raspberry Pi using the VNC Viewer software.

Installing the VNC Server Software

The first step is to install the VNC Server software on your Raspberry Pi. To do this, open a terminal window and type the following command:

sudo apt-get install tightvncserver

This will install the VNC Server software on your Raspberry Pi. Once the installation is complete, you can move on to the next step.

Configuring the VNC Server Software

Once the VNC Server software is installed, you need to configure it. To do this, type the following command in a terminal window:

vncserver :1

This will start the VNC Server and create a configuration file. You can then edit the configuration file to customize the VNC Server settings. For example, you can set a password for the VNC Server.

Installing the VNC Viewer Software

The next step is to install the VNC Viewer software on the computer or device you want to use to access your Raspberry Pi. You can download the VNC Viewer software from the RealVNC website. Once the software is installed, you can move on to the next step.

Connecting to Your Raspberry Pi

Once the VNC Server and VNC Viewer software are installed and configured, you can connect to your Raspberry Pi. To do this, open the VNC Viewer software and enter the IP address of your Raspberry Pi. You will then be prompted to enter the password you set for the VNC Server. Once you’ve entered the password, you will be connected to your Raspberry Pi.

Conclusion

VNC is a great way to access your Raspberry Pi remotely. In this guide, we’ve shown you how to get started with VNC on your Raspberry Pi. We’ve also shown you how to install and configure the VNC Server and VNC Viewer software, and how to connect to your Raspberry Pi.

Jaspreet Singh Ghuman

Jaspreet Singh Ghuman

Jassweb.com/

Passionate Professional Blogger, Freelancer, WordPress Enthusiast, Digital Marketer, Web Developer, Server Operator, Networking Expert. Empowering online presence with diverse skills.

jassweb logo

Jassweb always keeps its services up-to-date with the latest trends in the market, providing its customers all over the world with high-end and easily extensible internet, intranet, and extranet products.

Contact
San Vito Al Tagliamento 33078
Pordenone Italy
Item added to cart.
0 items - 0.00
Open chat
Scan the code
Hello 👋
Can we help you?