Ajouter Install_gitea.sh
This commit is contained in:
commit
cd5edc58c6
|
|
@ -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 <<EOF > /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)"
|
||||||
Loading…
Reference in New Issue