RaspberryPi-VNC
Hate having to plug in the Raspberry Pi to an external monitor and keyboard/mouse? This guide will let you set up a remote session on the Pi directly from your laptop. You'll be able to view and interact with the Pi desktop with just an ethernet cable.
Hardware
If your computer has an RJ45 ethernet port, all you need is an ethernet cable! Notebooks without this port will need an adapter (ie. thunderbolt to ethernet or USB 2.0/3.0/C to ethernet). Note that the MacBook Pro will require a thunderbolt to ethernet adapter -- USB to ethernet will only work on the MacBook Air.
Software
Connecting to the Raspberry Pi via SSH will require an SSI client application (ie. the Unix terminal in OSX). If you're using a Windows machine, you'll have to download PuTTY from http://www.greenend.org.uk.
Windows, MAC, and Linux machines will all require a VNC viewer program. RealVNC is known to work with the Raspberry Pi VNC server, it can be downloaded from http://www.realvnc.com/download/vnc/latest/. Download the package file and open it. During the setup you'll be offered a choice of the type of installation. Deselect VNC Server, because you only want VNC Viewer. Click Continue and go ahead with the rest of the installation.
Getting Started
- Ensure that SSH is enabled on the Pi. This is the default out of the box setting. You can verify the setting by typing
raspi-config
into terminal and navigating to ssh -> enable - Download a VNC server program. If you are using a MAC and don't have an external monitor/keyboard/mouse handy, you can wait to set this up after you've established an SSH connection to the Pi. You can also try installing a VNC server program via SSH on Windows but I can't guarantee that it will work (I'm not sure how internet sharing works in Windows). From the Pi's terminal type
sudo apt-get update
and thensudo apt-get install tightvncserver
. You will be prompted to confirm installation by typingY
. - Power off the pi and connect it to your laptop with the ethernet cable.
SSH for MAC/Linux
- Congratulations on owning a MAC. Ensure that the ethernet cable is securely connected between your computer and the Raspberry Pi.
- Enable internet sharing by navigating to Settings -> Sharing and turn Internet Sharing on for your Thunderbolt or USB ethernet connection.
- Plug in the wall power adapter into the Raspberry Pi, and then plug it into the wall to turn the power on. The Raspberry Pi will take a minute to boot up.
- Open terminal and SSH to the Pi with
ssh pi@raspberrypi.local
. If you're getting a host or timeout error, the Pi probably hasn't finished booting up yet. If all lights on the Pi are flashing indicating a full boot up but you're still not able to SSH, make sure SSH is enabled and type inarp -a
to view your network cache. The Pi should appear as a198.162.--.--
IP address. - You’ll be prompted to verify you’re trying to login to the Raspberry Pi. Type “yes” and press return. Type the password, which is “raspberry” and press return. Boom! You’re logged into your Raspberry Pi.
SSH for Windows
- Buy a Mac. If that doesn't work, ensure the ethernet cable is securely connected between your computer and the Raspberry Pi.
- Plug in the wall power adapter into the Raspberry Pi, and then plug it into the wall to turn the power on. The Raspberry Pi will take a minute to boot up.
- On your computer, open Putty and enter the Host Name as
raspberrypi.local
and press open. - If everything goes according to plan, you’ll be prompted with a security prompt. Press “Yes”
- This will open a terminal and ask for a Username and Password. The username is “pi” and the password is “raspberry“. After entering the credentials, you’ll get logged on to the Raspberry Pi terminal.
Setting up VNC
- We now need to run the VNC Server, so enter the following command into your SSH window:
vncserver :1
. If you haven't downloaded the VNC server application, follow step 2 of Getting Started. If you're using Windows, I can't guarantee that thetightvncserver
will download over your SSH connection. - If this is the first time you've started the VNC server, you will be prompted to enter and confirm a password. It would make sense to use “raspberry” for this, but passwords are limited to 8 characters, so I use “raspberr”. Note that this is the password that you will need to use to connect to the Raspberry Pi remotely. You will also be asked if you want to create a separate “read-only” password – say no.
- The VNC server is now running and so we can attempt to connect to it, but first we must switch to the computer from which we want to control the Pi and setup a VNC client to connect to the Pi. Open the VNC viewer you downloaded earlier and enter
raspberrypi.local:1
for the VNC Server. Leave the Encryption at the default setting and click Connect. Ignore the warning and enter the password you created earlier ("raspberr"). - The VNC window itself should appear. You're all set!