Introduction
If you like the idea of a headless computer setup for your Raspberry Pi (i.e. one without a keyboard, mouse, or monitor) but want access to the full graphical desktop, then you’re in luck! By using a Virtual Network Computing (VNC) program, you can access a remote desktop over the network!
For schools and individuals that need to use the full desktop for certain applications (Scratch, creating your own graphical interface, etc.), using a VNC client to access your Raspberry Pi might be the way to go.
Using RealVNC to access the Raspberry Pi’s graphical desktop
The good news is that Raspbian (the recommended Raspberry Pi operating system) comes with RealVNC installed by default. The bad news is that we need to enable it using some other means.
Required Materials
To follow along with this tutorial, you will need a Raspberry Pi, power supply, and micro SD card. Note that no monitor, keyboard, or mouse is required!
Optional Materials
All that being said, you can also use a keyboard, mouse, and monitor to enable the VNC server. Once you have enabled it, you will not need these accessories any more (unless you really want them).
Flashing the OS
The Raspberry Pi has several operating systems available for use, and beginners are often encouraged to use NOOBS to install the default Raspbian image. This guide will show you how to configure a headless version of Raspbian to be used with VNC. To do so, we’ll be following along with parts of the Headless Raspberry Pi Setup tutorial, but note that we’ll be using full Raspbian instead of Raspbian Lite, as we need the Linux X server that comes installed on the full version.
To start, download the latest version of Raspbian.
Note: This tutorial was created with Raspbian Stretch (version: June 2018). Using a different version may require performing different steps than what’s shown in this tutorial. If you would like to download the June 2018 version of Raspbian, it can be found below.
To flash the image to your SD card, we recommend the program Etcher. Download and install it. Plug your SD card into your computer (using a microSD USB Reader if necessary), and run Etcher. Select your OS image file (no need to unzip it! just select your downloaded .zip file in Etcher), select your SD card reader, and click the Flash! button.
Flashing the OS
The Raspberry Pi has several operating systems available for use, and beginners are often encouraged to use NOOBS to install the default Raspbian image. This guide will show you how to configure a headless version of Raspbian to be used with VNC. To do so, we’ll be following along with parts of the Headless Raspberry Pi Setup tutorial, but note that we’ll be using full Raspbian instead of Raspbian Lite, as we need the Linux X server that comes installed on the full version.
To start, download the latest version of Raspbian.
DOWNLOAD LATEST VERSION OF RASPBIAN
Note: This tutorial was created with Raspbian Stretch (version: June 2018). Using a different version may require performing different steps than what’s shown in this tutorial. If you would like to download the June 2018 version of Raspbian, it can be found below.
To flash the image to your SD card, we recommend the program Etcher. Download and install it. Plug your SD card into your computer (using a microSD USB Reader if necessary), and run Etcher. Select your OS image file (no need to unzip it! just select your downloaded .zip file in Etcher), select your SD card reader, and click the Flash! button.
Enable VNC
You will need to interact with your Pi in order to turn on the VNC server. To do this, you have several options:
- Connect a keyboard, mouse, and monitor. Click the Terminal icon on the top left of the desktop to open a terminal window.
- Follow these instructions to open a terminal window over a Serial connection.
- Follow these instructions to open a terminal window using SSH over Ethernet
- Follow these instructions to open a terminal window using SSH over WiFi
(Optional) Install RealVNC
By default, Raspbian should come with a VNC server (RealVNC) installed. If you are using another operating system, you might need to install RealVNC. With most flavors of Debian (e.g. Raspbian is built on top of Debian), you should be able to use apt-get to install RealVNC. In a terminal, enter the following:
sudo apt-get update
sudo apt-get install real-vnc-server
sudo apt-get install real-vnc-client
Enable the VNC Server
You will need to go into the Raspberry Pi configuration tool to turn on the VNC server:
sudo raspi-config
Select Interfacing Option, and then select VNC. On the next screen, select Yes, and press enter to save the changes.
Flashing the OS
The Raspberry Pi has several operating systems available for use, and beginners are often encouraged to use NOOBS to install the default Raspbian image. This guide will show you how to configure a headless version of Raspbian to be used with VNC. To do so, we’ll be following along with parts of the Headless Raspberry Pi Setup tutorial, but note that we’ll be using full Raspbian instead of Raspbian Lite, as we need the Linux X server that comes installed on the full version.
To start, download the latest version of Raspbian.
DOWNLOAD LATEST VERSION OF RASPBIAN
Note: This tutorial was created with Raspbian Stretch (version: June 2018). Using a different version may require performing different steps than what’s shown in this tutorial. If you would like to download the June 2018 version of Raspbian, it can be found below.
To flash the image to your SD card, we recommend the program Etcher. Download and install it. Plug your SD card into your computer (using a microSD USB Reader if necessary), and run Etcher. Select your OS image file (no need to unzip it! just select your downloaded .zip file in Etcher), select your SD card reader, and click the Flash! button.
Enable VNC
You will need to interact with your Pi in order to turn on the VNC server. To do this, you have several options:
- Connect a keyboard, mouse, and monitor. Click the Terminal icon on the top left of the desktop to open a terminal window.
- Follow these instructions to open a terminal window over a Serial connection.
- Follow these instructions to open a terminal window using SSH over Ethernet
- Follow these instructions to open a terminal window using SSH over WiFi
(Optional) Install RealVNC
By default, Raspbian should come with a VNC server (RealVNC) installed. If you are using another operating system, you might need to install RealVNC. With most flavors of Debian (e.g. Raspbian is built on top of Debian), you should be able to use apt-get to install RealVNC. In a terminal, enter the following:
sudo apt-get update
sudo apt-get install real-vnc-server
sudo apt-get install real-vnc-client
Enable the VNC Server
You will need to go into the Raspberry Pi configuration tool to turn on the VNC server:
sudo raspi-config
Select Interfacing Option, and then select VNC. On the next screen, select Yes, and press enter to save the changes.
Feel free to make any other changes you might like, including setting a new password and changing the keyboard layout.
Back in the raspi-config homescreen, press right arrow twice to select Finish and press enter.
Use VNC Over a Local Network
If your host computer is on the same local network (e.g. connected to the same WiFi or Ethernet network), then you can make a direct VNC connection to your Raspberry Pi. This method has several up sides: it’s the easier option, does not require signing up for a RealVNC account, and can be done on a closed network (i.e. one not connected to the Internet). The down side is that you must be on the same network to access your Pi (i.e. physically connected or through a VPN). This is a known as a direct connection.
If you want to to access your Raspberry Pi over the Internet, then see the next section.
Still in your Raspberry Pi’s terminal, enter the following command:
ifconfig
Copy down the Raspberry Pi’s IP address, which is given as a series of 4 numbers next to inet. If you are connected over WiFi, this will appear under the wlan0 settings. If you are connected over Ethernet, this will appear under the eth0settings.
On your host computer, head to the RealVNC Viewer downloads page to download the VNC client (known as VNC Viewer) for your operating system. Install it, accepting all the defaults.
Open VNC Viewer. At the top address bar, enter the IP address of the Raspberry Pi (once again, make sure your host computer and Pi are on the same network!).
Press enter, and click Continue when warned that “VNC Server not recognized.” You should be prompted with an Authentication window. If you did not change the login username and password for your Pi, your default login credentials are:
- Username: pi
- Password: raspberry
Once you successfully authenticate, you should be presented with your Raspberry Pi’s graphical desktop. Now, you can do everything remotely as if you were sitting in front of your Pi with a keyboard, mouse, and monitor! If you hover your mouse over the top part of the window, you should see a drop-down box appear, giving you access to the various RealVNC settings, including closing the session.
Use VNC Over the Internet
Using remote desktop on a local network is likely to offer a much faster and smoother experience, however, you can’t necessarily guarantee you will have access to that network directly. Luckily, RealVNC allows us to log in to our computer over the Internet!
The other good news is that we don’t have to go through the process of finding our Pi’s IP address.
Sign Up for a RealVNC Account
To start, sign up for an account (or sign in, if you already have one) on RealVNC’s site here. Head to your Account page, and click Activate under the Home version of VNC Connect.
Click More Info…..