This content is originally from PerfectPi, a sister site to SideGamer. The content is still useful for gamers, especially if you’re planning on creating a RetroPie system for retro gaming, so we’ve left it here for you to use. We hope you enjoy!
You don’t have to sit in front of your Raspberry Pi with a keyboard and mouse to be able to use it. You can connect via SSH to run commands via the terminal, but if you want the full Raspberry Pi experience, you’ll need to use remote desktop software like VNC.
Connecting to your Raspberry Pi using VNC will give you the same desktop environment you’d see if you were working on it directly. Let’s talk you through how to connect to a Raspberry Pi remote desktop, and how to set one up.
What You’ll Need
Before we get started, this guide will assume you have the following:
- Raspberry Pi, any model
- An SD/MicroSD card (8GB is usually recommended)
- Raspbian installed on your SD card
- A USB Keyboard/Mouse with a monitor, or SSH access enabled on your Raspberry Pi
- A second laptop, PC or smartphone to connect from
This guide will assume you’re using Raspbian, but VNC is well supported on Linux. You’ll be able to install VNC on any Linux distribution you choose to use.
Choosing VNC or RDP for Your Raspberry Pi Remote Desktop
You’ve got two options for setting up a remote desktop on a Raspberry Pi—VNC and RDP.
RDP stands for Remote Desktop Protocol. It’s Microsoft’s own remote desktop software, and it’s the protocol you’d use if you were using remote desktop on a Windows PC.
You might want to choose RDP, for instance, if you don’t want to install any additional software on a Windows PC. You can connect using the Remote Desktop Connection app that comes with Windows. Linux and macOS users would need to install a separate client, however.
The alternative is VNC or Virtual Network Computing. This protocol is free, but there are several variants available that use the protocol.
There are reasons why you might choose one over the other (speed, quality of the remote desktop, etc) but for ease, we recommend using RealVNC. It comes pre-installed with Raspbian, the recommended Raspberry Pi Linux distribution, but requires you to set things up first.
If you want to learn more about whether to choose VNC vs RDP, this guide should give you some additional answers.
Setting up RealVNC Server
You’ll need the latest version of Raspbian for your Raspberry Pi before you can proceed. Start by using SSH to connect to your Raspberry Pi, or opening up a terminal using a keyboard and mouse.
From there, run the following commands to update Raspbian and to make sure you have the latest version of RealVNC installed:
sudo apt update sudo apt install realvnc*
Once this is done, type
sudo raspi-config to open the Raspberry Pi configuration menu.
Go to Interfacing Options, select VNC, and then Yes. Alternatively, enable the RealVNC server service manually at the terminal or over SSH by typing:
sudo systemctl enable vncserver-x11-serviced.service sudo systemctl start vncserver-x11-serviced.service
Before you do connect, you should also make sure you’ve changed your default Raspberry Pi password for extra security, if you haven’t already. This is usually raspberry, and the default username is pi.
To change your password, run
passwd at the terminal.
Connecting to Your Raspberry Pi Remote Desktop
With RealVNC Server set up and ready, you should now be able to connect to it, but you’ll need a suitable VNC client installed on your machine first. Depending on your operating system, you could download VNC Viewer or a free, open-source alternative like TightVNC or Vinagre.
There are also VNC connection apps available in the Google Play and Apple App stores. We’ll use VNC Viewer as our example, but many of the steps will be similar, if not the same.
One step you’ll need to take, regardless of what VNC client you use, is finding out your Raspberry Pi’s IP address.
To do that, open a terminal or SSH connection, and type:
Open up VNC Viewer next, and type in your Raspberry Pi’s IP Address into the viewer. If it’s your first time connecting, you’ll receive a warning that the VNC server isn’t recognized, but just press Continue. You’ll then be asked to enter your username and password, so type those in, then press OK.
Once that’s done, you should then see your remote Raspberry Pi window appear, and be able to use it as if you were sat right in front of it.
Configuring RealVNC Server for Other VNC Clients
RealVNC is great, but it’s a little territorial and prevents you from logging in using your Raspberry Pi username and password unless you’re using VNC Viewer. If you want to connect to your Raspberry Pi using an alternative client like Vinagre, you’ll need to make some alterations to RealVNC’s configuration.
Open a terminal window or SSH connection, and type:
sudo nano /etc/vnc/config.d/common.custom
Authentication=VncAuth before hitting Ctrl+X and typing Y to confirm the file has saved. You’ll then need to set a separate VNC password by typing:
sudo vncpasswd -service
Select a suitably secure password, then reboot or type:
sudo systemctl restart vncserver-x11-serviced.service
You should then be able to connect using a non-RealVNC client like TightVNC.
Remote Desktop on a Headless Raspberry Pi
When we talk about a “headless” Raspberry Pi, we mean a Raspberry Pi that doesn’t have a monitor. IoT projects or Raspberry Pi’s running as servers aren’t generally hooked up to a screen, and don’t often come with the software you’d need to connect remotely.
If you’ve got a Raspberry Pi with a full GUI environment installed (eg. Raspbian, but not Raspbian Lite), you don’t need to do anything else. Once RealVNC is up and running, you can connect to it using VNC Viewer or another VNC client.
If you don’t have a Raspberry Pi with a full GUI environment, you’ll need to install a desktop environment. That’ll give you the GUI you can use when you connect remotely. The Raspberry Pi default desktop can be installed, without much of the unnecessary software that’s included with Raspbian, even on a Raspbian Lite installation.
To do that, type at the terminal, or over SSH:
sudo apt install raspberrypi-ui-mods
This is still a large installation, however (around 800MB). You can install alternatives, like XFCE, if you’d prefer.
Once it’s completed, reboot your Pi. You should then be able to connect using VNC as normal.
Your Raspberry Pi Remote Desktop Experience
You can put away the extra monitor, keyboard, and mouse. With your VNC server enabled, you’ll be able to access your Raspberry Pi remotely from your PC, laptop, or even your phone.
VNC isn’t your only option, though. If you’d prefer, you could install an RDP server using xrdp, allowing you to use Windows’ own Remote Desktop Connection tool. Thanks for reading!