Introduction au Serveur Panda

Présentation du Matériel

Le Serveur Panda utilise le matériel suivant :

Configuration préalable

Avant d'exécuter le script d'installation, activez l'autologin en mode console :

sudo raspi-config

Sélectionnez : System Options > Boot / Auto Login > Console Autologin.

Création et exécution du script d'installation

  1. Créez le fichier gx-ini.sh :
  2. nano gx-ini.sh
  3. Collez le script d'installation complet ci-dessous, sauvegardez avec CTRL+X, puis Y et Entrée.
  4. Rendez le fichier exécutable :
  5. chmod +x gx-ini.sh
  6. Exécutez le script avec droits administrateur :
  7. sudo ./gx-ini.sh

Script d'installation complet (gx-ini.sh)

#!/bin/bash
#!/bin/bash
# Installation complète du Kiosk Chromium + serveur Node.js "panda" + boot silencieux
# Pour Raspberry Pi OS Lite Bookworm (avec /boot/firmware)

USER=kb
HOME_DIR="/home/$USER"
SERVER_DIR="$HOME_DIR/server/panda"
PUBLIC_DIR="$SERVER_DIR/public"
URL="http://localhost:3000"

echo "####################################################"
echo "AUTO CONFIG GX-CODE -> Mise à jour du système..."
echo "####################################################"
apt update && apt upgrade -y


echo "📦 Installation de l’environnement graphique, Chromium, Node.js et PM2..."
apt install --no-install-recommends -y \
  xserver-xorg x11-xserver-utils xinit openbox chromium-browser curl unclutter

curl -fsSL https://deb.nodesource.com/setup_18.x | bash -
apt install -y nodejs
npm install -g pm2

echo "📁 Création du projet Node.js Express..."
mkdir -p "$PUBLIC_DIR"
chown -R "$USER:$USER" "$HOME_DIR/server"

sudo -u "$USER" bash < panda.js < {
  console.log('🐼 Serveur panda en ligne sur http://localhost:' + PORT);
});
JS

# HTML d'accueil avec fond noir + bouton refresh
cat > public/index.html <


  
  Panda Server
  


  

🐼 Bienvenue sur Panda

HTML # Lancement serveur avec PM2 pm2 start panda.js --name panda --watch pm2 save # Auto-start PM2 STARTUP_CMD=\$(pm2 startup systemd -u $USER --hp $HOME_DIR | grep sudo) eval \$STARTUP_CMD EOF echo "🖼 .xinitrc : Chromium fullscreen sans écran blanc..." cat > "$HOME_DIR/.xinitrc" <> "$HOME_DIR/.bash_profile" <<'EOF' if [ -z "$DISPLAY" ] && [ "$(tty)" = "/dev/tty1" ]; then startx fi EOF echo "🔒 Droits utilisateur $USER..." chown "$USER:$USER" "$HOME_DIR/.xinitrc" "$HOME_DIR/.bash_profile" echo "👥 Groupes video/tty..." usermod -aG video,tty "$USER" echo "🛠 Service systemd kiosk..." cat > /etc/systemd/system/chromium-kiosk.service <