From cd5edc58c656b79c8e2d000f086dd11001448fb0 Mon Sep 17 00:00:00 2001 From: Johnny Date: Fri, 26 Dec 2025 10:49:42 +0000 Subject: [PATCH] Ajouter Install_gitea.sh --- Install_gitea.sh | 56 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 Install_gitea.sh diff --git a/Install_gitea.sh b/Install_gitea.sh new file mode 100644 index 0000000..5c9d95e --- /dev/null +++ b/Install_gitea.sh @@ -0,0 +1,56 @@ +#!/bin/bash + +# Configuration +GITEA_VERSION="1.21.4" # À vérifier sur le dépôt officiel +GITEA_BINARY_URL="https://dl.gitea.com/gitea/${GITEA_VERSION}/gitea-${GITEA_VERSION}-linux-amd64" + +# Mettre à jour le système et installer les dépendances +apt update && apt install -y git sqlite3 gnupg2 curl + +# Créer l'utilisateur système pour Gitea +adduser \ + --system \ + --shell /bin/bash \ + --gecos 'Git Version Control' \ + --group \ + --disabled-password \ + --home /home/git \ + git + +# Créer l'arborescence des répertoires +mkdir -p /var/lib/gitea/{custom,data,log} +chown -R git:git /var/lib/gitea/ +chmod -R 750 /var/lib/gitea/ +mkdir -p /etc/gitea +chown root:git /etc/gitea +chmod 770 /etc/gitea + +# Télécharger le binaire Gitea +curl -L "$GITEA_BINARY_URL" -o /usr/local/bin/gitea +chmod +x /usr/local/bin/gitea + +# Création du service Systemd +cat < /etc/systemd/system/gitea.service +[Unit] +Description=Gitea (Git with a cup of tea) +After=network.target + +[Service] +RestartSec=2s +Type=simple +User=git +Group=git +WorkingDirectory=/var/lib/gitea/ +ExecStart=/usr/local/bin/gitea web --config /etc/gitea/app.ini +Restart=always +Environment=USER=git HOME=/home/git GITEA_WORK_DIR=/var/lib/gitea + +[Install] +WantedBy=multi-user.target +EOF + +# Activer et démarrer le service +systemctl daemon-reload +systemctl enable --now gitea + +echo "Installation terminée. Accédez à Gitea sur le port 3000 (http://ip_du_lxc:3000)" \ No newline at end of file