The Raspbian distribution supports the VNC remote desktop. It is very simple to set up and activate and does not require any technical skills to do it. The Raspberry Pi is an ideal platform for learning programming and electronics. You can recycle old computer equipment (screen, keyboard, mouse, SD card, 5V smartphone charger). The alternative is to access the Raspberry graphical desktop (called Pixel) remotely via a special connection called VNC which stands for Virtual Network Computing. To work, a VNC server must be installed on the Raspberry Pi, which will be responsible for managing the access rights, sending the screen image (like a video stream) and managing the user’s interactions. (keyboard mouse). If another computer (or why not a tablet or a smartphone), we will use a client (or Viewer).
Contents
Find the IP address of Raspberry Pi
You will need to know the address assigned by the router to the Raspberry Pi. To do this, open the Terminal and run the ifconfig command. Here, the RPI is at 192.168.1.24 on the local network. Follow this tutorial if you need to assign a fixed IP address to your Raspberry Pi.
Configure VNC on Raspbian
VNC allows access to Raspbian’s graphical desktop from another computer and tablet. Open the Terminal and run raspi-config with the sudo raspi-config command. Select Option 5 (Interfacing Option)
Then P3 VNC
The first time you activate VNC on the Raspbian distribution, you have to install all the necessary packages.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
Lecture des listes de paquets... Fait Construction de l'arbre des dépendances Lecture des informations d'état... Fait Les paquets supplémentaires suivants seront installés : bc cups cups-browsed cups-client cups-common cups-core-drivers cups-daemon cups-filters cups-filters-core-drivers cups-ppdc cups-server-common ghostscript gsfonts libcupscgi1 libcupsfilters1 libcupsimage2 libcupsmime1 libcupsppdc1 libfontembed1 libgs9 libgs9-common libgutenprint2 libijs-0.35 libjbig2dec0 libpoppler46 libqpdf13 poppler-data poppler-utils printer-driver-gutenprint qpdf Paquets suggérés : cups-bsd foomatic-db-compressed-ppds foomatic-db printer-driver-hpcups hplip cups-pdf xpp ghostscript-x gutenprint-locales fonts-japanese-mincho fonts-ipafont-mincho fonts-japanese-gothic fonts-ipafont-gothic fonts-arphic-ukai fonts-arphic-uming fonts-nanum gutenprint-doc Les NOUVEAUX paquets suivants seront installés : bc cups cups-browsed cups-client cups-common cups-core-drivers cups-daemon cups-filters cups-filters-core-drivers cups-ppdc cups-server-common ghostscript gsfonts libcupscgi1 libcupsfilters1 libcupsimage2 libcupsmime1 libcupsppdc1 libfontembed1 libgs9 libgs9-common libgutenprint2 libijs-0.35 libjbig2dec0 libpoppler46 libqpdf13 poppler-data poppler-utils printer-driver-gutenprint qpdf realvnc-vnc-server 0 mis à jour, 31 nouvellement installés, 0 à enlever et 0 non mis à jour. Il est nécessaire de prendre 20,9 Mo dans les archives. Après cette opération, 86,9 Mo d'espace disque supplémentaires seront utilisés. Souhaitez-vous continuer ? [O/n] O |
Accept the installation (O key) of the new packages. Raspbian takes care of everything, including installing the VNC server’s autostart script when the system boots.
Install a VNC viewer
There are many VNC clients for all platforms (macOS, Windows, Linux …) and for smartphones (iOS, Android …). RealVNC (website) is available on all platforms (including mobile). It is free for personal use. If you prefer to stay in 100% Open Source and free projects, pledge of privacy, you can turn to UltraVNC (official project page).
Go to the RealVNC site to retrieve the VNC viewer that matches your system.
Install and launch VNC Viewer on your computer.
In the address bar, enter the IP address of the Raspberry Pi (ifconfig command to find it) and confirm by pressing the Enter key on the keyboard. It is not necessary to specify port (5900) unless it has been manually changed.
In the window that appears, enter your username and password.
RealVNC informs you that the connection is not secure (it does not matter if you connect to the Raspberry Pi from a local network). Accept
Here you are on your Raspberry Pi: D. There is nothing more to configure. VNC starts automatically when the system starts! Here, my Raspberry Pi 3 test that also runs a Jeedom home automation server.
TightVNC
TightVNC (official project page) is a lightweight VNC server that runs on all Linux distributions as well as on Windows. This is an alternative to RealVNC used by the Raspberry Foundation. It requires more settings and configuration than RealVNC. It’s up to you to choose the solution that suits you best. Turnkey or Power User.
To install and configure TightVNC, follow this tutorial written for Armbian on an Orange Pi also applies to Raspbian Stretch.
Secure (encrypt) VNC access
If you connect to your Raspberry Pi from your local network, the lack of SSL encryption is not required. Everything can be intercepted on the network. The video stream, the actions with the mouse, the keys of the keyboard … If security is your obsession or if you must regularly access your Raspberry Pi from the internet (from your work or your smartphone), it is wise and strongly advised to encrypt your exchanges with this one.
There are several methods:
- Create an SSH tunnel into which the VNC stream will be injected. Follow this tutorial to set it up
- Use VNC Connect from RealVNC. Follow this tutorial by François Mocq (in french)
Add VNC access to a new user
If you need to add a new user to the system, it is necessary to configure a new output to the VNC server. To do this, simply open an SSH connection or Terminal and execute the vncserver command. Here for example, I added a user pi to Jeedom’s image.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
VNC(R) Server 6.1.1 (r28093) ARMv6 (May 19 2017 12:59:35) Copyright (C) 2002-2017 RealVNC Ltd. RealVNC et VNC sont des marques de commerce de RealVNC Ltd, déposées et/ou en cours de dépôt dans l'Union européenne, aux États-Unis et dans d'autres pays. Protégé par le brevet nº 2481870 au Royaume-Uni ; nº 8760366 aux États-Unis ; nº 2652951 dans l'UE. Voir https://www.realvnc.com pour plus d'informations sur VNC. Pour les avis de propriété intellectuelle d'entreprises tierces, voir : https://www.realvnc.com/docs/6.1/foss.html Génération de la clé privée... terminé Si un environnement de bureau ne se charge pas pour ce bureau virtuel, voir : https://www.realvnc.com/doclink/kb-345 Exécution d'applications dans /etc/vnc/xstartup Alias VNC Server : "Saint complex ground. Crash deluxe Julius." signature : 06-4a-cd-d9-96-17-d9-de Fichier journal : /home/pi/.vnc/jeedom:2.log Nouveau bureau : jeedom:2 (192.168.1.24:2) |
By launching the vnc server, it automatically configures a new output. It is accessed by adding: 2 after the IP address
To go further, here are more tutorials on Raspbian that might interest you
- Gateway RFLink with RobotDyn Arduino Mega 2560 Pro Mini and 3D printed case
- #Guide: which ESP8266 module to choose, power supply, how to program it in C++ with Arduino IDE, MicroPython, ESP Easy
- Install the Pixel Desktop on Raspbian Stretch Lite. 10 essential software for the Raspberry Pi 3
- #Guide: Which ESP32 development board to choose to develop DIY connected objects
- Configure VNC on Raspbian to remotely access the Pixel desktop of the Raspberry Pi
- #Deal: power supply case 6xAA batteries (9V) for Arduino, ESP8266, ESP32 projects
- #Test Waveshare 7 inch 1024×600 pixel LCD touch screen with acrylic holder for Raspberry Pi
- Weather station with ePaper display (Dashboard) for Jeedom on Raspberry Pi (via the JSON RPC API)
- #Test Waveshare ePaper (eInk) 2.7” inch SPI screen on Raspberry Pi in Python
- #Deal: ESP32 board for LoRaWan application development (SX1276 or SX1278) 433-868-915MHz
- #Deal: power supply case 4xAA batteries (6V) for Arduino, ESP8266, ESP32 projects
- #Deal: 5V Solar Powerbank up to 30000mAh for Arduino, ESP8266, ESP32, Raspberry Pi projects
- #Deal: FTDI module, USB to TTL RS232 serial port converter
- #Deal: voltage stabilizer 3.3V / 0.8A LD1117V33 (LD33V)
- #Deal: 3.7V LiPo battery up to 2500mAh with JST connector for ESP8266, ESP32, Raspberry Pi projects
- Install the Pixel Desktop on Raspbian Stretch Lite. 10 essential software for the Raspberry Pi 3
- Configure VNC on Raspbian to remotely access the Pixel desktop of the Raspberry Pi
- Make a DIY Recalbox or Retropie retro gaming arcade with joystick and 8 buttons for less than €85
- WebSocket communication with an ESP8266 or Arduino in Python. Test with the ws4py library on Raspberry Pi
- Python library evdev on Raspberry Pi to use a Gamepad in your DIY projects (servomotor, games, robotic…)
- DiskioPi, DIY touch pad kit made from Raspberry Pi 3 comes back with a new design in 2018