# Photomaton LSDW - Guide d'installation from scratch > Ce guide permet de remonter le photomaton completement a partir d'un Raspberry Pi 4 (2 Go) neuf. > Reconstitue a partir de l'historique bash du Pi original. > Derniere mise a jour : Juin 2026 --- ## Table des matieres 1. [Prerequis](#1-prerequis) 2. [Installation de l'OS](#2-installation-de-los) 3. [Configuration initiale du Pi](#3-configuration-initiale-du-pi) 4. [Installation de photobooth-app](#4-installation-de-photobooth-app) 5. [Installation de RaspAP (hotspot WiFi)](#5-installation-de-raspap-hotspot-wifi) 6. [Installation de Zoraxy (reverse proxy)](#6-installation-de-zoraxy-reverse-proxy) 7. [Certificat TLS (Let's Encrypt + OVH)](#7-certificat-tls-lets-encrypt--ovh) 8. [Configuration des imprimantes (CUPS + Selphy)](#8-configuration-des-imprimantes-cups--selphy) 9. [Installation de Node-RED](#9-installation-de-node-red) 10. [NeoPixels (WS2812)](#10-neopixels-ws2812) 11. [Configuration du mode kiosk (Chromium)](#11-configuration-du-mode-kiosk-chromium) 12. [Optimisation systeme](#12-optimisation-systeme) 13. [Services systemd](#13-services-systemd) 14. [Verification finale](#14-verification-finale) 15. [Post-installation : contenu a restaurer](#15-post-installation--contenu-a-restaurer) --- ## 1. Prerequis ### Materiel necessaire - Raspberry Pi 4 (2 Go RAM) - Carte microSD (32 Go minimum, classe A2 recommandee) - Camera Module 3 officielle Raspberry Pi - Ecran HDMI - Bouton physique lumineux 12V avec relay - NeoPixels WS2812 (35 LEDs, strip) - Canon Selphy CP1300 x2 (blanche + noire) + cables USB - Cable Ethernet (pour l'installation initiale et les certificats) - Clavier + souris (pour l'installation initiale) ### Logiciels sur le PC - Raspberry Pi Imager (pour flasher la carte SD) - Un client SSH (terminal, PuTTY, etc.) --- ## 2. Installation de l'OS ### Flasher la carte SD 1. Telecharger et installer [Raspberry Pi Imager](https://www.raspberrypi.com/software/) 2. Choisir l'OS : **Raspberry Pi OS (64-bit)** base sur Debian 13 Trixie - Version **Desktop** (pas Lite, on a besoin de l'environnement graphique pour Chromium) - Architecture **arm64** 3. Dans les options avancees (engrenage) : - Hostname : `PiPhotobooth` - Activer SSH (authentification par mot de passe) - Utilisateur : `pi` / mot de passe : `[choisir un mot de passe]` - Locale : `fr_FR.UTF-8`, timezone : `Europe/Paris` - WiFi : ne pas configurer (on utilisera RaspAP) 4. Flasher la carte SD ### Premier demarrage 1. Inserer la carte SD, connecter l'ecran HDMI, le clavier, et le cable Ethernet 2. Demarrer le Pi 3. Attendre la fin du premier boot (peut prendre 2-3 minutes) 4. Se connecter en SSH : `ssh pi@PiPhotobooth.local` --- ## 3. Configuration initiale du Pi ### Mise a jour systeme ```bash sudo apt update sudo apt upgrade -y ``` ### Configuration avec raspi-config ```bash sudo raspi-config ``` Configurer : - **System Options > Boot / Auto Login** : Desktop Autologin (B4) - **Interface Options > Camera** : Activer (si demande) - **Localisation Options** : Locale fr_FR.UTF-8, Timezone Europe/Paris - **Advanced Options > Expand Filesystem** (si pas fait automatiquement) ### Desactiver les services inutiles ```bash sudo systemctl disable bluetooth.service sudo systemctl disable wg-quick@wg0.service 2>/dev/null ``` ### Desactiver cloud-init (si present) ```bash sudo touch /etc/cloud/cloud-init.disabled ``` ### Configurer /etc/hosts ```bash sudo nano /etc/hosts ``` Ajouter : ``` 127.0.0.1 localhost 127.0.1.1 PiPhotobooth 10.3.141.1 photomaton.lessapinsduweb.com 10.3.141.1 photomaton-nodered.lessapinsduweb.com 10.3.141.1 photomaton-raspap.lessapinsduweb.com 10.3.141.1 photomaton-zoraxy.lessapinsduweb.com ``` Si cloud-init ecrase `/etc/hosts`, editer aussi le template : ```bash sudo nano /etc/cloud/templates/hosts.debian.tmpl ``` ### Redemarrer ```bash sudo reboot ``` --- ## 4. Installation de photobooth-app ### Dependances ```bash sudo apt -y install ffmpeg libturbojpeg0 libgl1 libgphoto2-dev fonts-noto-color-emoji sudo apt -y install libexif12 libgphoto2-6 libgphoto2-port12 libltdl7 sudo apt -y install python3-dev sudo apt -y install pipx sudo apt -y install imagemagick ``` ### Installation via pipx ```bash pipx ensurepath # Fermer et rouvrir le terminal (ou source ~/.bashrc) exit ``` ```bash ssh pi@PiPhotobooth.local pipx install --system-site-packages photobooth-app --pip-args='--prefer-binary' ``` ### Creer le dossier de donnees ```bash mkdir ~/photobooth-data ``` ### Verifier que la camera fonctionne ```bash rpicam-hello --list-cameras -v ``` ### Premier lancement (test) ```bash cd ~/photobooth-data photobooth --port 8083 ``` Verifier sur `http://PiPhotobooth.local:8083` que l'interface fonctionne. Arreter avec Ctrl+C. ### Configuration de photobooth-app Le service systemd est installe automatiquement par photobooth-app dans : `~/.local/share/systemd/user/photobooth-app.service` Editer pour configurer le port et les dependances : ```bash nano ~/.local/share/systemd/user/photobooth-app.service ``` Contenu recommande : ```ini [Unit] Description=photobooth-app After=zoraxy.service raspapd.service [Service] Type=simple Restart=always WorkingDirectory=/home/pi/photobooth-data ExecStart=/home/pi/.local/share/pipx/venvs/photobooth-app/bin/python -O -m photobooth --port 8083 [Install] WantedBy=default.target ``` Points importants : - `After=zoraxy.service raspapd.service` : attend que Zoraxy et RaspAP soient prets - `--port 8083` : port d'ecoute - `Restart=always` : relance en cas de crash Activer et demarrer : ```bash systemctl --user daemon-reload systemctl --user enable photobooth-app systemctl --user start photobooth-app ``` Activer le linger (pour que le service demarre au boot sans login) : ```bash sudo loginctl enable-linger pi ``` Verifier : ```bash systemctl --user status photobooth-app journalctl --user --unit=photobooth-app -n 50 --no-pager ``` ### Configuration dans l'interface admin Acceder a `http://PiPhotobooth.local:8083/admin` et configurer : - **common** : `logging_level` -> `WARNING` (pas DEBUG !) - **backends** : Camera Module 3, backend Picamera2, resolution 2304x1536 - **hardwareinputoutput** : `gpio_enabled` -> `true` - **mediaprocessing** : `full_still_length` -> 2304, `preview_still_length` -> 1200 - **misc** : Changer `secret_key` (generer avec `python3 -c "import secrets; print(secrets.token_hex(32))"`) Voir `config/photobooth-config-optimized.json` pour la config complete recommandee. --- ## 5. Installation de RaspAP (hotspot WiFi) ### Installation automatique ```bash curl -sL https://install.raspap.com | bash ``` Suivre les instructions. Repondre oui aux questions par defaut. Apres l'installation, le Pi redemarrera avec un hotspot WiFi actif. ### Configuration du hotspot Acceder a l'interface RaspAP : `http://10.3.141.1:8082` (ou `http://PiPhotobooth.local:8082` via Ethernet) Login par defaut : `admin` / `secret` (changer le mot de passe !) Configurer : - **Hotspot > Basic** : - SSID : `Photomaton` (ou le nom souhaite) - Security : WPA2 - Mot de passe WiFi : `[choisir]` - **Hotspot > Advanced** : - Country code : FR - Channel : choisir un canal peu encombre ### Configuration DNS (dnsmasq) Creer le fichier de resolution locale : ```bash sudo nano /etc/dnsmasq.d/090_custom_local_hotspot.conf ``` Contenu : ``` address=/lessapinsduweb.com/10.3.141.1 address=/photomaton.lessapinsduweb.com/10.3.141.1 address=/#/127.0.0.1 ``` Redemarrer dnsmasq : ```bash sudo systemctl restart dnsmasq.service ``` Verifier : ```bash dig @127.0.0.1 photomaton.lessapinsduweb.com A # Doit repondre 10.3.141.1 ``` ### Changer le port lighttpd (si conflit) Si lighttpd est sur le port 80 (conflit avec Zoraxy), le changer : ```bash sudo nano /etc/lighttpd/lighttpd.conf ``` Changer `server.port = 80` en `server.port = 8082` (devrait deja etre fait par RaspAP). --- ## 6. Installation de Zoraxy (reverse proxy) ### Telecharger et installer ```bash mkdir ~/zoraxy cd ~/zoraxy # Telecharger la derniere version arm64 # Verifier la derniere release sur https://github.com/tobychui/zoraxy/releases wget https://github.com/tobychui/zoraxy/releases/download/v3.3.2/zoraxy_linux_arm64 mv zoraxy_linux_arm64 zoraxy chmod +x zoraxy ``` ### Creer le script de demarrage ```bash nano ~/zoraxy/start.sh ``` Contenu : ```bash #!/bin/bash cd /home/pi/zoraxy ./zoraxy -port=:8001 ``` ```bash chmod +x ~/zoraxy/start.sh ``` ### Creer le service systemd ```bash sudo nano /etc/systemd/system/zoraxy.service ``` Contenu : ```ini [Unit] Description=Zoraxy Reverse Proxy After=network.target [Service] Type=simple ExecStart=/home/pi/zoraxy/start.sh Restart=always RestartSec=5 [Install] WantedBy=multi-user.target ``` ```bash sudo systemctl daemon-reload sudo systemctl enable zoraxy.service sudo systemctl start zoraxy.service ``` Verifier : ```bash sudo systemctl status zoraxy.service sudo ss -ltnp | grep zoraxy ``` ### Configurer les proxies Acceder a l'admin Zoraxy : `http://127.0.0.1:8001` (ou `http://PiPhotobooth.local:8001` via Ethernet) Creer les 4 proxies : **1. photomaton.lessapinsduweb.com -> 127.0.0.1:8083** - WebSocket Custom Headers : ON - Disable Chunked Transfer Encoding : ON - Skip Certificate Validations : ON **2. photomaton-nodered.lessapinsduweb.com -> 127.0.0.1:1880** - Options par defaut **3. photomaton-raspap.lessapinsduweb.com -> 127.0.0.1:8082** - Options par defaut **4. photomaton-zoraxy.lessapinsduweb.com -> 127.0.0.1:8001** - Options par defaut --- ## 7. Certificat TLS (Let's Encrypt + OVH) > Le certificat est necessaire pour HTTPS. Comme le Pi n'a pas d'acces internet permanent > (WiFi isole), on utilise le challenge DNS via l'API OVH. > Cette etape necessite un cable Ethernet connecte a internet. ### Installer certbot avec le plugin OVH ```bash sudo apt install certbot # ou via venv si le paquet n'existe pas : # sudo python3 -m venv /opt/certbot/ # sudo /opt/certbot/bin/pip install --upgrade pip # sudo /opt/certbot/bin/pip install certbot certbot-dns-ovh # sudo ln -s /opt/certbot/bin/certbot /usr/local/bin/certbot ``` ### Configurer les credentials OVH Creer les credentials API OVH sur https://api.ovh.com/createToken/ ```bash nano ~/.ovhapi ``` Contenu : ```ini dns_ovh_endpoint = ovh-eu dns_ovh_application_key = VOTRE_APP_KEY dns_ovh_application_secret = VOTRE_APP_SECRET dns_ovh_consumer_key = VOTRE_CONSUMER_KEY ``` ```bash chmod 600 ~/.ovhapi ``` ### Generer le certificat **Important** : Le Pi doit etre connecte a internet via Ethernet pour cette etape. ```bash sudo certbot certonly \ --dns-ovh \ --dns-ovh-credentials ~/.ovhapi \ -d photomaton.lessapinsduweb.com \ -d photomaton-nodered.lessapinsduweb.com \ -d photomaton-raspap.lessapinsduweb.com \ -d photomaton-zoraxy.lessapinsduweb.com ``` Les certificats sont generes dans `/etc/letsencrypt/live/photomaton.lessapinsduweb.com/`. ### Importer dans Zoraxy Dans l'admin Zoraxy (`http://127.0.0.1:8001`) : 1. Aller dans TLS / SSL 2. Importer le certificat : - Certificate : contenu de `/etc/letsencrypt/live/photomaton.lessapinsduweb.com/fullchain.pem` - Private Key : contenu de `/etc/letsencrypt/live/photomaton.lessapinsduweb.com/privkey.pem` ### Renouvellement Le certificat expire tous les 90 jours. Pour renouveler : 1. Connecter le Pi a internet via Ethernet 2. Lancer : `sudo certbot renew` 3. Reimporter dans Zoraxy si necessaire > Note : Ce n'est pas automatise car le Pi n'a pas d'acces internet permanent. > Penser a renouveler avant chaque saison d'events. --- ## 8. Configuration des imprimantes (CUPS + Selphy) ### Installer les paquets ```bash sudo apt -y install cups printer-driver-gutenprint cups-client ``` ### Configurer les permissions ```bash sudo usermod -aG lpadmin pi sudo usermod -aG lp pi ``` ### Configurer CUPS pour l'acces distant ```bash sudo cupsctl --remote-any sudo systemctl restart cups ``` ### Gestion du driver USB La Selphy CP1300 peut utiliser ipp-usb ou usblp. Pour eviter les conflits : ```bash # Verifier si ipp-usb est installe sudo apt list --installed | grep ipp # Si necessaire, blacklister usblp pour utiliser ipp-usb # (ou l'inverse selon ce qui fonctionne) sudo nano /etc/modprobe.d/blacklist-usblp.conf ``` Contenu (si on utilise ipp-usb) : ``` # blacklist usblp ``` ### Ajouter les imprimantes 1. Brancher les 2 Canon Selphy CP1300 en USB 2. Aller sur `http://localhost:631` (ou `https://photomaton-raspap.lessapinsduweb.com` via WiFi) 3. Administration > Add Printer 4. Selectionner l'imprimante USB Canon 5. Nommer : - Premiere (blanche) : `Canon_SELPHY_CP1300_usb_blanche` - Deuxieme (noire) : `Canon_SELPHY_CP1300_usb_noire` 6. Selectionner le driver Gutenprint Verification : ```bash lpstat -v lpstat -p ``` ### Installer le script d'impression ```bash mkdir -p ~/photobooth-data/script cp scripts/script_print.sh ~/photobooth-data/script/ chmod +x ~/photobooth-data/script/script_print.sh ``` ### Tester l'impression ```bash # Prendre une photo de test via photobooth-app, puis : cd ~/photobooth-data/media/processed_full/ lp -d Canon_SELPHY_CP1300_usb_blanche -o landscape -o fit-to-page [nom_fichier].jpg ``` --- ## 9. Installation de Node-RED ### Installation via le script officiel ```bash bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered) ``` Repondre oui aux questions. Le script installe Node.js et Node-RED, et cree le service systemd. ### Activer le service ```bash sudo systemctl enable nodered.service sudo systemctl start nodered.service ``` ### Installer les nodes necessaires Acceder a Node-RED : `http://PiPhotobooth.local:1880` Dans le menu hamburger > Manage palette > Install, installer : - `node-red-node-pi-gpio` (GPIO input/output) - `node-red-node-pi-neopixel` (NeoPixels WS2812) - `node-red-node-sqlite` (base SQLite) - `node-red-dashboard` ou `@flowfuse/node-red-dashboard` (Dashboard v2) - `node-red-contrib-button-events` (multi-clic bouton) ### Importer les flows 1. Dans Node-RED, menu hamburger > Import 2. Coller le contenu du fichier de flows (backup dans `config/nodered-flows-backup.json`) 3. Deploy ### Creer la base SQLite ```bash sudo apt install sqlite3 ``` La base est creee automatiquement par Node-RED au premier usage, mais on peut la creer manuellement : ```bash sqlite3 ~/photobooth-data/photo-to-print.sqlite ``` ```sql CREATE TABLE photoToPrint( id INT PRIMARY KEY, filename TEXT NOT NULL, uid TEXT NOT NULL, toPrint INT DEFAULT 1, printed BOOLEAN DEFAULT 0, created_at TEXT NOT NULL DEFAULT current_timestamp ); .quit ``` --- ## 10. NeoPixels (WS2812) ### Cablage - Data : GPIO18 - Alimentation : 5V + GND - 35 LEDs ### Via Node-RED (methode utilisee) Le node `node-red-node-pi-neopixel` gere les NeoPixels directement. Il lance un script Python en `sudo` : ``` /home/pi/.node-red/node_modules/node-red-node-pi-neopixel/neopix.py 35 0 pixels 100 true 0 18 ``` Pas d'installation supplementaire requise au-dela du node Node-RED. ### Note : uvicorn sur le port 8081 Le processus uvicorn sur le port 8081 est l'**API backend de RaspAP** (`/etc/raspap/api/main.py`), pas un service NeoPixels. Il est lance automatiquement par RaspAP et ne doit pas etre desactive. Le dossier `~/ws2812/` est un ancien test NeoPixels inactif (rien ne le lance). Il peut etre supprime si souhaite. --- ## 11. Configuration du mode kiosk (Chromium) ### Fichier desktop ```bash nano ~/Desktop/photobooth-app.desktop ``` Contenu : ```ini [Desktop Entry] X-GNOME-Autostart-enabled=true X-GNOME-Autostart-Delay=120 Terminal=false Type=Application Name=Photobooth-App Exec=bash -c "sleep 60 && chromium --kiosk --accept-lang=fr-FR --incognito --password-store=basic --disable-features=Translate,OverscrollHistoryNavigation --noerrdialogs --disable-infobars --no-first-run --ozone-platform=wayland --enable-features=OverlayScrollbar --start-maximized http://127.0.0.1:8083/" StartupNotify=false ``` ### Points importants - Le binaire est `chromium` (pas `chromium-browser`) sous Debian 13 Trixie - `--ozone-platform=wayland` : utilisation native de Wayland (le compositeur est labwc) - Le fichier est dans `~/Desktop/`, pas dans `~/.config/autostart/` - Le `sleep 60` + `X-GNOME-Autostart-Delay=120` laissent le temps a photobooth-app de demarrer - `--incognito` : pas de cache persistant, pas de popups "restore session" ### Lien symbolique pour autostart ```bash sudo ln -s /home/pi/Desktop/photobooth-app.desktop /etc/xdg/autostart/photobooth.desktop ``` --- ## 12. Optimisation systeme ### Scripts d'optimisation Copier le dossier `photomaton/` sur le Pi, puis : ```bash # Optimisation systeme (swap, kernel, services) sudo bash scripts/optimize-system.sh sudo reboot # Optimisation desktop (desactiver composants inutiles, ~231 Mo) sudo bash scripts/optimize-desktop.sh sudo reboot ``` ### Optimisations manuelles rapides Si on ne veut pas lancer les scripts complets : ```bash # Baisser le swappiness (60 -> 10) sudo sysctl vm.swappiness=10 echo 'vm.swappiness=10' | sudo tee /etc/sysctl.d/99-photomaton-swap.conf # Desactiver rpcbind (inutile) sudo systemctl disable rpcbind.service rpcbind.socket sudo systemctl stop rpcbind.service rpcbind.socket # Desactiver ModemManager (inutile) sudo systemctl disable ModemManager.service sudo systemctl stop ModemManager.service # Desactiver bluetooth sudo systemctl disable bluetooth.service sudo systemctl stop bluetooth.service # Ajouter un swapfile de securite (en complement de zram) sudo fallocate -l 1G /swapfile sudo chmod 600 /swapfile sudo mkswap /swapfile sudo swapon -p 10 /swapfile echo '/swapfile none swap sw,pri=10 0 0' | sudo tee -a /etc/fstab ``` --- ## 13. Services systemd ### Liste des services du photomaton | Service | Type | Fichier | Gere par | |---------|------|---------|----------| | photobooth-app | User | `~/.local/share/systemd/user/photobooth-app.service` | pipx (auto-installe), After=zoraxy+raspapd | | nodered | System | `/etc/systemd/system/nodered.service` | Script officiel Node-RED | | zoraxy | System | `/etc/systemd/system/zoraxy.service` | Manuel (voir section 6) | | cups | System | (pre-installe) | apt | | hostapd | System | (pre-installe) | RaspAP | | dnsmasq | System | (pre-installe) | RaspAP | | lighttpd | System | (pre-installe) | RaspAP | | dhcpcd | System | (pre-installe) | RaspAP | ### Services optionnels (surveillance) ```bash # Watchdog (health check toutes les 2 minutes) sudo cp systemd/photobooth-watchdog.service /etc/systemd/system/ sudo cp systemd/photobooth-watchdog.timer /etc/systemd/system/ # Editer ExecStart pour pointer vers le bon chemin de health-check.sh sudo systemctl daemon-reload sudo systemctl enable photobooth-watchdog.timer sudo systemctl start photobooth-watchdog.timer # Maintenance quotidienne (4h du matin) sudo cp systemd/photobooth-maintenance.service /etc/systemd/system/ sudo cp systemd/photobooth-maintenance.timer /etc/systemd/system/ # Editer ExecStart pour pointer vers le bon chemin de maintenance.sh sudo systemctl daemon-reload sudo systemctl enable photobooth-maintenance.timer sudo systemctl start photobooth-maintenance.timer ``` ### Verification des services ```bash # Tous les services actifs sudo systemctl list-unit-files --type=service --state=enabled # Etat de chaque service systemctl --user status photobooth-app sudo systemctl status nodered sudo systemctl status zoraxy sudo systemctl status cups sudo systemctl status hostapd sudo systemctl status dnsmasq ``` --- ## 14. Verification finale ### Checklist ```bash # 1. Tous les services tournent ? systemctl --user status photobooth-app # active sudo systemctl status nodered # active sudo systemctl status zoraxy # active sudo systemctl status cups # active sudo systemctl status hostapd # active sudo systemctl status dnsmasq # active # 2. Tous les ports ecoutent ? sudo ss -ltnp # Attendu : 22, 53, 80, 443, 631, 1880, 5487, 8001, 8082, 8083 # 3. Camera detectee ? rpicam-hello --list-cameras # 4. Imprimantes detectees ? lpstat -v lpstat -p # 5. DNS fonctionne ? dig @127.0.0.1 photomaton.lessapinsduweb.com A # Doit repondre 10.3.141.1 # 6. HTTPS fonctionne ? curl -k https://photomaton.lessapinsduweb.com/ # (depuis le Pi lui-meme, ou depuis un telephone connecte au WiFi) # 7. Memoire ? free -h # Verifier que Swap est present (zram + swapfile) # 8. Health check complet bash scripts/health-check.sh ``` ### Test fonctionnel complet 1. Connecter un telephone au WiFi "Photomaton" 2. Appuyer sur le bouton physique (1 clic) 3. Verifier le countdown sur l'ecran 4. Verifier que la photo est prise et apparait dans la galerie 5. Scanner le QR code avec le telephone 6. Verifier que la photo se telecharge 7. Cliquer "Demander l'impression" dans la galerie 8. Sur le dashboard Node-RED (telephone) : valider l'impression 9. Verifier que la Selphy imprime correctement --- ## 15. Post-installation : contenu a restaurer ### Fichiers a copier depuis une sauvegarde ```bash # Cadres et fonds ~/photobooth-data/userdata/hopnbloc/ ~/photobooth-data/userdata/LSDW/ ~/photobooth-data/userdata/demoassets/ # Script d'impression ~/photobooth-data/script/script_print.sh # Configuration photobooth-app ~/photobooth-data/config/config.json # Flows Node-RED ~/.node-red/flows.json # Config Zoraxy (proxies) ~/zoraxy/conf/proxy/*.config # Config dnsmasq custom /etc/dnsmasq.d/090_custom_local_hotspot.conf # Credentials OVH (pour certbot) ~/.ovhapi ``` ### Sauvegarder le systeme Pour eviter de devoir tout refaire, creer une image de la carte SD : ```bash # Sur le PC (pas sur le Pi), avec la carte SD inseree : sudo dd if=/dev/sdX of=photomaton-backup-$(date +%Y%m%d).img bs=4M status=progress ``` Ou utiliser `rpi-clone` pour cloner sur une deuxieme carte SD.