# Installation Complète sur DietPi

### Raspberry Pi Zero 2 W – Affichage HDMI en Mode Kiosk

*Documentation officielle du setup Immich Kiosk*

---

#### 🧩 Introduction

Ce guide détaille l’installation complète d’un écran Immich Kiosk sur un Raspberry Pi Zero 2 W avec **DietPi**, en utilisant :

- Immich Kiosk (backend)
- Chromium en mode Kiosk (frontend)
- Démarrage automatique plein écran
- Résolution HDMI 1080p
- Masquage du curseur

---

#### 🧩 Préparation de l’image DietPi

Télécharger l’image pour Raspberry Pi Zero 2 W :

👉 **DietPi – Raspberry Pi ARMv8 / ARM64**  
[https://dietpi.com/<span aria-hidden="true" class="ms-0.5 inline-block align-middle leading-none"><svg class="block h-[0.75em] w-[0.75em] stroke-current stroke-[0.75]" data-rtl-flip="" fill="currentColor" height="20" viewbox="0 0 20 20" width="20" xmlns="http://www.w3.org/2000/svg"><path d="M14.3349 13.3301V6.60645L5.47065 15.4707C5.21095 15.7304 4.78895 15.7304 4.52925 15.4707C4.26955 15.211 4.26955 14.789 4.52925 14.5293L13.3935 5.66504H6.66011C6.29284 5.66504 5.99507 5.36727 5.99507 5C5.99507 4.63273 6.29284 4.33496 6.66011 4.33496H14.9999L15.1337 4.34863C15.4369 4.41057 15.665 4.67857 15.665 5V13.3301C15.6649 13.6973 15.3672 13.9951 14.9999 13.9951C14.6327 13.9951 14.335 13.6973 14.3349 13.3301Z"></path></svg></span>](https://dietpi.com/)

Flasher la carte SD avec **Balena Etcher** ou **Raspberry PI Imager**.

---

#### 🧩 Configuration avant premier boot

Les fichiers suivants sont à modifier sur la partition **/boot/**.

---

##### ✔ dietpi.txt

```shell
AUTO_SETUP_LOCALE=fr_FR.UTF-8
AUTO_SETUP_KEYBOARD_LAYOUT=fr
AUTO_SETUP_TIMEZONE=Europe/Paris

AUTO_SETUP_NET_ETHERNET_ENABLED=0
AUTO_SETUP_NET_WIFI_ENABLED=1
AUTO_SETUP_NET_WIFI_COUNTRY_CODE=FR

AUTO_SETUP_NET_USESTATIC=0
AUTO_SETUP_BOOT_WAIT_FOR_NETWORK=1

```

---

##### ✔ dietpi-wifi.txt (entrée 0)

```shell
aWIFI_SSID[0]='Thymon 2,4Ghz'
aWIFI_KEY[0]='ReseauThymon13'
aWIFI_KEYMGR[0]='WPA-PSK'

```

---

#### 🧩 Premier démarrage du Raspberry Pi

Le système configure automatiquement :

- langue
- clavier
- WiFi
- SSH

Ensuite, on se connecte via SSH pour poursuivre l’installation.

```bash
ssh root@IP
```

---

#### 🧩 Installation de Chromium en mode Kiosk

Installer Chromium :

```shell
dietpi-software install 113
```

Configurer le mode autostart :

```
dietpi-autostart
```

Choisir :  
`11 : Chromium Kiosk Mode `

Définir l’URL à afficher :  
`<a href="http://127.0.0.1:3000">http:</a><span class="hljs-comment"><a href="http://127.0.0.1:3000">//127.0.0.1:300</a></span>`

---

#### 🧩 Configuration de l’affichage HDMI (1080p)

Modifier la résolution HDMI dans :

```shell
sudo nano /boot/config.txt
```

Ajouter :

<div class="bg-token-bg-elevated-secondary text-token-text-secondary flex items-center gap-4 rounded-sm px-2 font-sans text-xs" id="bkmrk--8"></div>```
hdmi_force_hotplug=1
hdmi_group=1
hdmi_mode=16
disable_overscan=1
```

Configurer Chromium pour 1080p :

```shell
sudo nano /boot/dietpi.txt
```

Définir :

```
SOFTWARE_CHROMIUM_RES_X=1920
SOFTWARE_CHROMIUM_RES_Y=1080
```

<div class="contain-inline-size rounded-2xl relative bg-token-sidebar-surface-primary" id="bkmrk--9"><div class="sticky top-9"><div class="absolute end-0 bottom-0 flex h-9 items-center pe-2">  
</div></div></div>---

#### 🧩 Ajustement du script Chromium Autostart

Éditer :

```shell
sudo nano /var/lib/dietpi/dietpi-software/installed/chromium-autostart.sh
```

Remplacer par :

```bash
#!/bin/dash

RES_X=$(sed -n '/^[[:blank:]]*SOFTWARE_CHROMIUM_RES_X=/{s/^[^=]*=//p;q}' /boot/dietpi.txt)
RES_Y=$(sed -n '/^[[:blank:]]*SOFTWARE_CHROMIUM_RES_Y=/{s/^[^=]*=//p;q}' /boot/dietpi.txt)

cat > /tmp/xinitrc.tmp << 'EOF'
#!/bin/dash
unclutter -idle 0 -root &
exec "$@"
EOF
chmod +x /tmp/xinitrc.tmp

CHROMIUM_OPTS="--kiosk --no-memcheck --window-size=${RES_X:-1280},${RES_Y:-720} --window-position=0,0"

URL=$(sed -n '/^[[:blank:]]*SOFTWARE_CHROMIUM_AUTOSTART_URL=/{s/^[^=]*=//p;q}' /boot/dietpi.txt)

FP_CHROMIUM=$(command -v chromium-browser)
[ "$FP_CHROMIUM" ] || FP_CHROMIUM=$(command -v chromium)

STARTX='xinit'
[ "$USER" = 'root' ] || STARTX='startx'

exec "$STARTX" /tmp/xinitrc.tmp "$FP_CHROMIUM" $CHROMIUM_OPTS "${URL:-https://dietpi.com/}"

```

<div class="contain-inline-size rounded-2xl relative bg-token-sidebar-surface-primary" id="bkmrk--13"><div class="sticky top-9"><div class="absolute end-0 bottom-0 flex h-9 items-center pe-2"><div class="bg-token-bg-elevated-secondary text-token-text-secondary flex items-center gap-4 rounded-sm px-2 font-sans text-xs">  
</div></div></div><div class="overflow-y-auto p-4" dir="ltr">  
</div></div>---

#### 🧩 Installation d’Immich Kiosk (backend)

Télécharger le binaire ARM64 :

```
wget https://github.com/damongolding/immich-kiosk/releases/latest/download/immich-kiosk_Linux_arm64.tar.gz
```

Extraire :

```shell
tar -xzf immich-kiosk_Linux_arm64.tar.gz
```

Créer le dossier config :

```shell
mkdir -p /root/config 
wget -O /root/config/config.yaml https://raw.githubusercontent.com/damongolding/immich-kiosk/refs/heads/main/config.example.yaml
```

Modifier le fichier config.yaml :

```shell
nano /root/config/config.yaml
```

Exemple :

```yaml
immich_url: "https://MON_IP_IMMICH:2283" 
immich_api_key: "CLE_API_IMMICH"
```

---

#### 🧩 Création du service systemd Immich Kiosk

Créer le fichier :

```shell
sudo nano /etc/systemd/system/immich-kiosk.service
```

Ajouter :

```shell
[Unit]
Description=Immich Kiosk
After=network.target
StartLimitIntervalSec=0

[Service]
Type=simple
Restart=always
RestartSec=2
User=root
WorkingDirectory=/root
ExecStart=/root/immich-kiosk --config /root/config/config.yaml
Environment=HOME=/root

[Install]
WantedBy=multi-user.target
```

Activer le service :

```shell
sudo systemctl daemon-reload 
sudo systemctl enable immich-kiosk 
sudo systemctl start immich-kiosk
```

---

#### 🧩 Vérifications finales

Immich Kiosk tourne :

```
systemctl status immich-kiosk
```

Port 3000 ouvert :

```
ss -tulnp | grep 3000
```

Test local :

```
curl http://127.0.0.1:3000
```

Reboot final :

```
reboot
```

Après redémarrage, l’écran HDMI affichera **Immich Kiosk plein écran 1080p**, sans curseur.

---

#### 🎉 Fin du guide

Tu disposes maintenant d’un setup stable, automatique et optimisé pour diffuser les photos Immich sur un écran dédié.