Nous sommes là pour vous aider
VNC Connect and Raspberry Pi¶
If you have Raspbian Jessie with PIXEL, VNC Connect is included with your Raspberry Pi. It’s completely free for non-commercial use.
VNC Connect consists of two apps, VNC Server and VNC Viewer:
- VNC Server enables you to connect to your Pi from a desktop computer or mobile device, watch its screen in real-time, and exercise control as though you were sitting in front of it.
- VNC Viewer enables you to connect to and control a desktop computer (or another Pi) from your Pi, should you want to.
If you have an earlier version of Raspbian, or a different Linux distribution, you can install VNC Connect yourself.
Setting up your Raspberry Pi¶
VNC Connect is included with Raspbian but you still have to enable it.
First, run the following commands to make sure you have the latest version of VNC Server and VNC Viewer:
sudo apt-get update
sudo apt-get install realvnc-vnc-server
sudo apt-get install realvnc-vnc-viewer
If you’re already using an older version of VNC Server, restart it. If not, and you’re already booted into the PIXEL desktop, select Menu > Preferences > Raspberry Pi Configuration > Interfaces and make sure VNC is set to Enabled.
Alternatively, run the command
sudo raspi-config, navigate to Advanced Options > VNC and select Yes.
From now on, VNC Server will start automatically every time you boot your Raspberry Pi. See how to stop VNC Server.
By default, VNC Server remotes the graphical desktop running on your Raspberry Pi. However, if your Pi is headless (not plugged into a monitor) or not running a graphical desktop, VNC Server can still give you graphical remote access using a virtual desktop.
Getting connected to your Raspberry Pi¶
There are two ways to connect; you can use either or both. Please make sure you’ve downloaded our VNC Viewer app to computers or devices you want to control from.
Establishing a direct connection¶
Direct connections are quick and simple providing you’re joined to the same private local network as your Raspberry Pi (for example, a wired or Wi-Fi network at home, school or in the office).
If you’re connecting over the Internet, it’s much safer and more convenient to establish a cloud connection.
On your Raspberry Pi, discover its private IP address by double-clicking the VNC Server icon on the taskbar and examining the status dialog:
On the device you will use to take control, run VNC Viewer and enter the IP address in the search bar:
Establishing a cloud connection¶
Cloud connections are convenient and encrypted end-to-end, and highly recommended for connections over the Internet. There’s no firewall or router reconfiguration, and you don’t need to know the IP address of your Raspberry Pi, or provide a static one.
You’ll need a RealVNC account; it’s completely free to set up and only takes a few seconds. We’ll give you a special version of our Home subscription that enables both cloud and direct connectivity, and also in-session features such as system authentication, file transfer, printing and chat.
You can apply your Home subscription to five Raspberry Pis and/or desktop computers in total. Please note you revert to the standard feature set for Windows, Mac and Linux desktop computers.
Sign up for a RealVNC account by entering your email address in the box on this page, and following the instructions.
On your Raspberry Pi, select Licensing from the VNC Server status menu, choose Sign in to your RealVNC account, and enter your new account email and password:
On the device you will use to take control, run VNC Viewer and sign in using the same account credentials.
In VNC Viewer, a connection to your Raspberry Pi automatically appears under the name of your team. Simply tap or double-click to connect:
Authenticating to VNC Server¶
To complete either a direct or cloud connection you must authenticate to VNC Server. Enter the user name and password you normally use to log on to your user account on the Raspberry Pi.
By default, these credentials are
raspberry, but hopefully you’ll have changed them to something more secure by now!
Running directly rendered apps such as Minecraft remotely¶
VNC Server can remote the screen of Raspberry Pi apps that use a directly rendered overlay, such as Minecraft, the text console, the Pi camera module, and more.
To turn this feature on, open the VNC Server dialog, navigate to Menu > Options > Troubleshooting, and select Enable experimental direct capture mode. On the device you will use to take control, run VNC Viewer and connect (if already connected, you’ll need to reconnect).
Direct screen capture is an experimental feature. If you’re connecting from a desktop computer and mouse movements seem erratic, try pressing F8 to open the VNC Viewer shortcut menu, and select Relative Pointer Motion.
If performance seems impaired, try:
- On your Raspberry Pi, run
sudo raspi-config, navigate to Advanced options > Memory Split, and ensure your GPU has at least 128MB.
- Reduce your Raspberry Pi’s screen resolution.
If you still encounter problems, please let us know.
Transferring files and printing remotely¶
You can transfer files to and from your Raspberry Pi providing you’re connecting from VNC Viewer running on a Windows, Mac or Linux desktop computer.
- To transfer files to your Raspberry Pi, click the VNC Viewer toolbar button and follow the instructions. Detailed steps are here.
- To transfer files from your Raspberry Pi, use VNC Viewer to open the VNC Server dialog remotely, select Menu > File transfer, and follow the instructions. Detailed steps are here.
It can be really useful to print to a printer attached to your Windows, Mac or Linux computer if no printer is set up for your Raspberry Pi.
To do this, first run the following command on your Raspberry Pi to install
cups (the Common Unix Printing System):
sudo apt-get install cups
Then, use VNC Viewer to select File > Print remotely (or whatever the standard command is for the page or file you want to print). VNC Server directs the output to VNC Viewer, and spools it to your local printer. There’s more information about remote printing here.
Creating and remoting a virtual desktop¶
If your Raspberry Pi is headless (that is, not plugged into a monitor) or embedded in a robot, it’s unlikely to be running a graphical desktop.
VNC Server can run in Virtual Mode to create a resource-efficient virtual desktop on demand, giving you graphical remote access even when there is no actual desktop to remote. This virtual desktop exists only in your Raspberry Pi’s memory:
To do this:
- On your Raspberry Pi, run the command
vncserver. Make a note of the IP address/display number printed to the console, for example
- On the device you will use to take control, enter this information in VNC Viewer.
Stopping a virtual desktop¶
A virtual desktop persists until you explicitly destroy it. Run the following command when you are sure it is no longer needed:
vncserver -kill :<display-number>
Note this command will terminate any current connections without warning to those users.
Operating VNC Server at the command line¶
You can operate VNC Server exclusively at the command line or via SSH if you prefer.
Common commands for Raspbian Jessie (which is based on Debian 8, and uses
- To start VNC Server now:
sudo systemctl start vncserver-x11-serviced.service
- To start VNC Server at next boot, and every subsequent boot:
sudo systemctl enable vncserver-x11-serviced.service
- To stop VNC Server:
sudo systemctl stop vncserver-x11-serviced.service
- To prevent VNC Server starting at boot:
sudo systemctl disable vncserver-x11-serviced.service
For equivalent commands for Raspbian Wheezy (which is based on Debian 7, and uses
initd), see this page.
Troubleshooting VNC Server¶
Changing the Raspberry Pi’s screen resolution¶
You may want to do this if:
- Performance is impaired. A smaller screen resolution gives a more responsive experience.
- Your Raspberry Pi is headless (that is, not plugged into a monitor) and the default initial screen resolution is too small.
To change the resolution, run the command
sudo raspi-config, navigate to Advanced Options > Resolution, and choose an option.
If this menu is not available, or you want more control, specify settings in the
||Tells your Pi an HDMI display is attached.|
||Ignores EDID/display data.|
||Defines the HDMI output group.|
||Forces (for example) 1024x768 at 60Hz.|
See the Raspberry Pi documentation for more
options, and information on
/boot/config.txt in general. You will need to reboot your Raspberry Pi for any changes to take effect.
Note that settings you specify in this file override monitors you subsequently plug in (unless you revert
so pick a ‘headless’ resolution compatible with your regular monitor.
Specifying a screen resolution for a virtual desktop¶
If you run VNC Server in Virtual Mode to create a virtual desktop, you can specify the screen resolution (geometry) at start up, for example:
You can even specify multiple screen resolutions and cycle between them.
Optimizing for Raspberry Pi Zero and Pi 1¶
If performance is impaired for direct connections to a Raspberry Pi Zero or Pi 1, try turning off encryption if you are sure your private local network is secure. This reduces CPU usage.
You cannot turn off encryption for cloud connections.
- On your Raspberry Pi, open the VNC Server dialog and select Menu > Options > Expert.
- Change the
- Restart any existing connections.
If performance is still impaired, try reducing your Raspberry Pi’s screen resolution.