Ultima attività 1 month ago

glances_install_docker_or_pipx.md Raw

Installation complète de Glances Web avec pipx (Debian 12 / Proxmox)

Ce guide installe Glances 4.x (FastAPI Web UI) proprement avec pipx, sans casser Python système (PEP 668). Compatible Debian 12 / Proxmox, CLI only.


1. Prérequis système

apt update
apt install -y python3 python3-venv python3-full pipx

Activer pipx dans le PATH :

pipx ensurepath
export PATH=$PATH:/root/.local/bin

2. Installation de Glances via pipx

pipx install glances

Vérification :

which glances
glances --version

Résultat attendu :

/root/.local/bin/glances
Glances 4.x.x

3. Installer les dépendances Web (OBLIGATOIRE)

Glances 4.x utilise FastAPI pour le mode Web.

pipx inject glances fastapi uvicorn

Vérifier :

pipx list

4. Test manuel du Web

glances -w -B 0.0.0.0

Accès :

http://IP_DU_SERVEUR:61208

5. Configuration Glances (custom)

Créer le dossier :

mkdir -p /root/.config/glances
nano /root/.config/glances/glances.conf

Exemple de configuration :

[global]
refresh=2
check_update=false

[cpu]
hide=false

[mem]
hide=false

[disk]
hide=false

[diskio]
hide=false

[network]
hide=false

[docker]
hide=false

6. Service systemd (démarrage automatique)

Créer le service :

nano /etc/systemd/system/glances-web.service

Contenu :

[Unit]
Description=Glances Web (pipx)
After=network.target

[Service]
Type=simple
User=root
Environment=HOME=/root
Environment=PATH=/root/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
ExecStart=/root/.local/bin/glances -w -B 0.0.0.0
Restart=on-failure
RestartSec=3

[Install]
WantedBy=multi-user.target

Activer :

systemctl daemon-reload
systemctl enable --now glances-web

Vérifier :

systemctl status glances-web

7. Dépannage rapide

Erreur FastAPI

pipx inject glances fastapi uvicorn

Port déjà utilisé

ss -lntp | grep 61208

Changer le port si besoin :

ExecStart=/root/.local/bin/glances -w -B 0.0.0.0 -p 61209

8. Bonnes pratiques

  • ❌ Ne jamais utiliser pip install glances
  • ❌ Ne jamais utiliser --break-system-packages
  • ✅ pipx ou Docker uniquement
  • ⭐ Docker recommandé en PROD

9. Accès final

http://IP_DU_SERVEUR:61208

FIN.

install_glances_docker.md Raw

Installation complète de Glances Web avec Docker (Debian 12 / Proxmox)

Ce guide décrit une installation PRODUCTION READY de Glances Web via Docker. Aucune dépendance Python, aucune limitation PEP 668. Recommandé pour Proxmox / Debian 12 / serveurs headless.


1. Prérequis Docker

apt update
apt install -y ca-certificates curl gnupg
curl -fsSL https://get.docker.com | sh
systemctl enable --now docker

Test :

docker run hello-world

2. Arborescence recommandée

mkdir -p /opt/glances
cd /opt/glances

3. Fichier de configuration Glances (custom)

mkdir -p /opt/glances/config
nano /opt/glances/config/glances.conf

Exemple :

[global]
refresh=2
check_update=false

[cpu]
hide=false

[mem]
hide=false

[disk]
hide=false

[diskio]
hide=false

[network]
hide=false

[docker]
hide=false

4. Lancer Glances Web (FULL FEATURES)

docker run -d \
  --name glances \
  --pid host \
  --privileged \
  -p 61208:61208 \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -v /opt/glances/config:/glances/conf \
  --restart unless-stopped \
  nicolargo/glances

Accès :

http://IP_DU_SERVEUR:61208

5. Variables utiles

Variable Description
GLANCES_OPT Options glances
-w Mode Web
-p Port custom
-B Bind IP

Exemple :

-e GLANCES_OPT="-w -p 61209 -B 0.0.0.0"

6. Docker Compose (optionnel)

nano /opt/glances/docker-compose.yml
version: "3.9"

services:
  glances:
    image: nicolargo/glances
    container_name: glances
    pid: host
    privileged: true
    ports:
      - "61208:61208"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /opt/glances/config:/glances/conf
    environment:
      - GLANCES_OPT=-w
    restart: unless-stopped

Lancer :

docker compose up -d

7. Logs & debug

docker logs glances
docker inspect glances

8. Sécurité (recommandé)

  • Restreindre le port via firewall
  • Mettre Glances derrière Nginx
  • Ajouter authentification HTTP

9. Bonnes pratiques

  • ✅ Docker = méthode la plus stable
  • ❌ Pas de Python système
  • ❌ Pas de pip
  • ⭐ Recommandé sur Proxmox

10. Accès final

http://IP_DU_SERVEUR:61208

FIN.