draft: gitea, l'installation
This commit is contained in:
+5
-5
@@ -1,7 +1,7 @@
|
||||
=== 2026-05-16 14:26:22 — démarrage ===
|
||||
=== 2026-05-16 17:06:28 — démarrage ===
|
||||
Branche : main
|
||||
|
||||
Cloning into '/tmp/tmp.CcUPbsrddZ/app'...
|
||||
Cloning into '/tmp/tmp.U1mqESxG2C/app'...
|
||||
Installing dependencies from lock file
|
||||
Verifying lock file contents can be installed on current platform.
|
||||
Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. It is recommended that you run `composer update` or `composer update <package name>`.
|
||||
@@ -19,7 +19,7 @@ Cannot create cache directory /var/www/.cache/composer/files/, or directory is n
|
||||
- Downloading graham-campbell/result-type (v1.1.3)
|
||||
- Downloading vlucas/phpdotenv (v5.6.2)
|
||||
0/11 [>---------------------------] 0%
|
||||
9/11 [======================>-----] 81%
|
||||
5/11 [============>---------------] 45%
|
||||
10/11 [=========================>--] 90%
|
||||
11/11 [============================] 100%
|
||||
- Installing paragonie/random_compat (v9.99.100): Extracting archive
|
||||
@@ -34,7 +34,7 @@ Cannot create cache directory /var/www/.cache/composer/files/, or directory is n
|
||||
- Installing graham-campbell/result-type (v1.1.3): Extracting archive
|
||||
- Installing vlucas/phpdotenv (v5.6.2): Extracting archive
|
||||
0/11 [>---------------------------] 0%
|
||||
8/11 [====================>-------] 72%
|
||||
9/11 [======================>-----] 81%
|
||||
11/11 [============================] 100%
|
||||
Generating optimized autoload files
|
||||
Class UpdateChecker located in ./src/UpdateChecker.php does not comply with psr-4 autoloading standard (rule: App\ => ./src). Skipping.
|
||||
@@ -60,4 +60,4 @@ Class DataGit located in ./src/DataGit.php does not comply with psr-4 autoloadin
|
||||
Use the `composer fund` command to find out more!
|
||||
(aucune migration en attente)
|
||||
|
||||
=== 2026-05-16 14:26:25 — succès ===
|
||||
=== 2026-05-16 17:06:32 — succès ===
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"fetched_at":1778941752,"version":"1.6.25"}
|
||||
{"fetched_at":1778943994,"version":"1.6.26"}
|
||||
|
||||
@@ -174,3 +174,11 @@
|
||||
{"ts":"2026-05-16 14:59:06","url":"/informatique/linux/applications/fail2ban","ref":"","ua":"Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-us) AppleWebKit/412 (KHTML, like Gecko) Safari/412"}
|
||||
{"ts":"2026-05-16 14:59:43","url":"/informatique/linux/applications/flatseal","ref":"","ua":"Mozilla/5.0 (Macintosh; Intel Mac OS X 11.4; rv:130.0) Gecko/20100101 Firefox/130.0"}
|
||||
{"ts":"2026-05-16 15:01:33","url":"/loisirs/musique/john-williams-out-of-this-world","ref":"","ua":"Mozilla/5.0 (Macintosh; Intel Mac OS X 11_7_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.6778.265 Safari/537.36"}
|
||||
{"ts":"2026-05-16 15:03:26","url":"/informatique/linux/commandes/touch","ref":"https://abonnel.fr/informatique/linux/commandes/touch","ua":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; SleepBot/1.0; +http://sleepbot.com/) Chrome/131.0.0.0 Safari/537.36"}
|
||||
{"ts":"2026-05-16 15:05:39","url":"/vie_pratique/granieu/index","ref":"","ua":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36"}
|
||||
{"ts":"2026-05-16 15:06:35","url":"/feed-news","ref":"","ua":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.6723.191 Safari/537.36"}
|
||||
{"ts":"2026-05-16 15:07:57","url":"/informatique/linux/system/installer-tous-les-packs-de-langue-francais-sous-fedora","ref":"https://www.google.com/","ua":"Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Mobile Safari/537.36"}
|
||||
{"ts":"2026-05-16 15:08:23","url":"/informatique/se/linux/applications/creer_serveur_linux_apache_2_mysql_php","ref":"https://www.abonnel.fr/","ua":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36"}
|
||||
{"ts":"2026-05-16 15:08:49","url":"/journal_geek/2020/20201205-pourquoi-choisir-une-passerelle-zigbee-athome","ref":"https://hackernoon.com/how-to-transform-a-raspberrypi-into-a-universal-zigbee-and-z-wave-bridge-xy1ay3ymz","ua":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.3588.173 Safari/537.36"}
|
||||
{"ts":"2026-05-16 15:08:58","url":"/informatique/linux/system/installer-tous-les-packs-de-langue-francais-sous-fedora","ref":"https://www.google.com/","ua":"Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Mobile Safari/537.36"}
|
||||
{"ts":"2026-05-16 15:09:00","url":"/electronique/ces-technos-qui-n-ont-jamais-encore-percees","ref":"","ua":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36"}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"title": "Gitea : installation sur Debian 13 avec PostgreSQL",
|
||||
"_updated_at": "2026-05-16 15:09:48"
|
||||
}
|
||||
@@ -0,0 +1,251 @@
|
||||
# Gitea : installation sur Debian 13 avec PostgreSQL
|
||||
|
||||
Gitea est une forge Git légère, auto-hébergée, écrite en Go. Elle offre une alternative sobre à GitLab pour héberger ses dépôts, ses tickets et ses pull requests sur une machine modeste. Ce guide décrit une installation complète sur **Debian 13**, avec **PostgreSQL** comme base de données et un **reverse-proxy** (Nginx dans l'exemple) pour exposer Gitea derrière HTTPS sur `git.abonnel.fr`.
|
||||
|
||||
---
|
||||
|
||||
## 1. Pré-requis
|
||||
|
||||
- Un serveur Debian 13 à jour :
|
||||
|
||||
```bash
|
||||
sudo apt update && sudo apt upgrade -y
|
||||
```
|
||||
- Les paquets de base :
|
||||
|
||||
```bash
|
||||
sudo apt install -y git ca-certificates wget
|
||||
```
|
||||
- Un enregistrement DNS A (ou AAAA) pour `git.abonnel.fr` pointant vers le serveur.
|
||||
- Les ports 80 et 443 ouverts (pour le reverse-proxy et Let's Encrypt).
|
||||
|
||||
---
|
||||
|
||||
## 2. PostgreSQL : installation et création de la base
|
||||
|
||||
1. Installer PostgreSQL :
|
||||
|
||||
```bash
|
||||
sudo apt install -y postgresql postgresql-contrib
|
||||
```
|
||||
2. Créer la base et l'utilisateur Gitea. On ouvre d'abord un shell `postgres`, puis `psql` :
|
||||
|
||||
```bash
|
||||
sudo -i -u postgres
|
||||
```
|
||||
```sql
|
||||
psql
|
||||
CREATE ROLE gitea WITH LOGIN PASSWORD 'votre_mot_de_passe_sécurisé';
|
||||
CREATE DATABASE gitea WITH OWNER gitea ENCODING 'UTF8' TEMPLATE template0;
|
||||
\q
|
||||
```
|
||||
```bash
|
||||
exit
|
||||
```
|
||||
|
||||
Ces étapes suivent la documentation officielle Gitea pour PostgreSQL. ([Gitea Documentation][1])
|
||||
3. Vérifier que le service tourne :
|
||||
|
||||
```bash
|
||||
sudo systemctl status postgresql
|
||||
```
|
||||
|
||||
> Si Gitea et PostgreSQL sont sur la même machine, la configuration par défaut (connexions locales via `127.0.0.1`) suffit. Sinon, ajustez `pg_hba.conf` et `postgresql.conf`.
|
||||
|
||||
---
|
||||
|
||||
## 3. Installation de Gitea
|
||||
|
||||
### 3.1 Utilisateur système
|
||||
|
||||
Gitea s'exécute sous un utilisateur dédié, sans mot de passe :
|
||||
|
||||
```bash
|
||||
sudo adduser --system --shell /bin/bash --gecos 'Git Version Control' \
|
||||
--group --disabled-password --home /home/git git
|
||||
```
|
||||
([Gitea Documentation][2])
|
||||
|
||||
### 3.2 Arborescence et permissions
|
||||
|
||||
```bash
|
||||
sudo mkdir -p /var/lib/gitea/{custom,data,log}
|
||||
sudo chown -R git:git /var/lib/gitea/
|
||||
sudo chmod -R 750 /var/lib/gitea/
|
||||
sudo mkdir /etc/gitea
|
||||
sudo chown root:git /etc/gitea
|
||||
sudo chmod 770 /etc/gitea
|
||||
```
|
||||
|
||||
Le `770` sur `/etc/gitea` permet à l'assistant web d'écrire `app.ini` pendant l'installation. On le resserrera ensuite. ([Gitea Documentation][3])
|
||||
|
||||
### 3.3 Récupérer le binaire
|
||||
|
||||
Vérifiez la dernière version sur [dl.gitea.com](https://dl.gitea.com/gitea/) avant de télécharger :
|
||||
|
||||
```bash
|
||||
wget -O gitea https://dl.gitea.com/gitea/1.24.7/gitea-1.24.7-linux-amd64
|
||||
chmod +x gitea
|
||||
sudo mv gitea /usr/local/bin/gitea
|
||||
```
|
||||
|
||||
Pensez à vérifier la signature GPG ou la somme `.sha256` publiée à côté du binaire. ([Gitea Documentation][2])
|
||||
|
||||
### 3.4 Service systemd
|
||||
|
||||
Créez `/etc/systemd/system/gitea.service` :
|
||||
|
||||
```ini
|
||||
[Unit]
|
||||
Description=Gitea (Git with a cup of tea)
|
||||
After=network.target postgresql.service
|
||||
Requires=postgresql.service
|
||||
|
||||
[Service]
|
||||
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
|
||||
```
|
||||
|
||||
Puis :
|
||||
|
||||
```bash
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable --now gitea
|
||||
sudo systemctl status gitea
|
||||
```
|
||||
([Gitea Documentation][4])
|
||||
|
||||
---
|
||||
|
||||
## 4. Assistant d'installation web
|
||||
|
||||
Avant de brancher le proxy HTTPS, terminez l'install initiale en HTTP direct : ouvrez `http://votre-serveur:3000` et complétez l'assistant.
|
||||
|
||||
- **Type de base** : PostgreSQL
|
||||
- **Host** : `127.0.0.1:5432`
|
||||
- **Database** : `gitea`
|
||||
- **Username** : `gitea`
|
||||
- **Password** : celui défini en section 2
|
||||
- **Base URL** : `https://git.abonnel.fr/` (l'URL publique finale, même si l'on est encore en HTTP)
|
||||
- Créez le compte administrateur.
|
||||
|
||||
L'assistant écrit `/etc/gitea/app.ini`. Vous pouvez ensuite resserrer les permissions :
|
||||
|
||||
```bash
|
||||
sudo chmod 750 /etc/gitea
|
||||
sudo chmod 640 /etc/gitea/app.ini
|
||||
```
|
||||
([James R. S. Kemp Git][5])
|
||||
|
||||
---
|
||||
|
||||
## 5. Reverse-proxy et HTTPS
|
||||
|
||||
### 5.1 Nginx
|
||||
|
||||
`/etc/nginx/sites-available/git.abonnel.fr` :
|
||||
|
||||
```nginx
|
||||
server {
|
||||
listen 80;
|
||||
server_name git.abonnel.fr;
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl http2;
|
||||
server_name git.abonnel.fr;
|
||||
|
||||
ssl_certificate /etc/letsencrypt/live/git.abonnel.fr/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/git.abonnel.fr/privkey.pem;
|
||||
|
||||
client_max_body_size 512M; # pour les gros push
|
||||
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:3000;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Activez le site, testez la conf, rechargez :
|
||||
|
||||
```bash
|
||||
sudo ln -s /etc/nginx/sites-available/git.abonnel.fr /etc/nginx/sites-enabled/
|
||||
sudo nginx -t && sudo systemctl reload nginx
|
||||
```
|
||||
|
||||
Pour Traefik ou un autre proxy, le principe reste identique : router `git.abonnel.fr` vers `127.0.0.1:3000` et terminer TLS au niveau du proxy.
|
||||
|
||||
### 5.2 Certificat Let's Encrypt
|
||||
|
||||
```bash
|
||||
sudo apt install -y certbot python3-certbot-nginx
|
||||
sudo certbot --nginx -d git.abonnel.fr
|
||||
```
|
||||
|
||||
Certbot ajoute lui-même la directive SSL et programme le renouvellement.
|
||||
|
||||
---
|
||||
|
||||
## 6. Ajustements dans `app.ini`
|
||||
|
||||
Quelques réglages utiles dans `/etc/gitea/app.ini` une fois le proxy en place :
|
||||
|
||||
```ini
|
||||
[server]
|
||||
DOMAIN = git.abonnel.fr
|
||||
ROOT_URL = https://git.abonnel.fr/
|
||||
HTTP_ADDR = 127.0.0.1
|
||||
HTTP_PORT = 3000
|
||||
START_SSH_SERVER = false
|
||||
SSH_PORT = 22
|
||||
|
||||
[database]
|
||||
DB_TYPE = postgres
|
||||
HOST = 127.0.0.1:5432
|
||||
NAME = gitea
|
||||
USER = gitea
|
||||
PASSWD = votre_mot_de_passe
|
||||
SSL_MODE = disable
|
||||
|
||||
[service]
|
||||
DISABLE_REGISTRATION = true
|
||||
REQUIRE_SIGNIN_VIEW = false
|
||||
```
|
||||
|
||||
`HTTP_ADDR = 127.0.0.1` empêche Gitea d'écouter sur l'extérieur — seul Nginx le voit. Désactiver l'inscription publique évite la création de comptes par des inconnus.
|
||||
|
||||
Redémarrez après modification :
|
||||
|
||||
```bash
|
||||
sudo systemctl restart gitea
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 7. Sécurité et entretien
|
||||
|
||||
- **Pare-feu** : n'exposez que 80, 443 et 22 (SSH) ; gardez 3000 et 5432 en local.
|
||||
- **Sauvegardes** : dump quotidien de la base (`pg_dump gitea`) + archive de `/var/lib/gitea/data` (dépôts, attachments, LFS).
|
||||
- **Logs** : `/var/lib/gitea/log/` et `journalctl -u gitea`.
|
||||
- **Mises à jour** : remplacer le binaire `/usr/local/bin/gitea` par une version récente, puis `systemctl restart gitea`. PostgreSQL suit les mises à jour Debian.
|
||||
- **SSH Git** : si vous utilisez le port 22 du système pour `git@git.abonnel.fr:...`, ajoutez les clés publiques dans Gitea (qui les pousse dans `~git/.ssh/authorized_keys`). Pensez à `fail2ban` pour limiter le brute-force SSH.
|
||||
|
||||
---
|
||||
|
||||
[1]: https://docs.gitea.com/enterprise/installation/linux?utm_source=chatgpt.com "Install on Linux | Gitea Enterprise Documentations"
|
||||
[2]: https://docs.gitea.com/installation/install-from-binary?utm_source=chatgpt.com "Installation from binary | Gitea Documentation"
|
||||
[3]: https://docs.gitea.com/1.18/installation/install-from-binary?utm_source=chatgpt.com "Installation from binary | Gitea Documentation"
|
||||
[4]: https://docs.gitea.com/1.20/category/installation?utm_source=chatgpt.com "Installation | Gitea Documentation"
|
||||
[5]: https://git.jamesrskemp.com/hosting/gitea.html?utm_source=chatgpt.com "Gitea - Git Commands by James Skemp"
|
||||
Reference in New Issue
Block a user