GitLab self-managed vous donne un contrôle total sur vos données, vos pipelines et votre configuration. Le package Omnibus (méthode recommandée) installe GitLab et toutes ses dépendances en une seule commande, sans avoir à gérer séparément PostgreSQL, Redis, Nginx ou Gitaly. Ce guide couvre l’installation sur Ubuntu 24.04 et RHEL/Rocky 9, avec les prérequis exacts, les étapes validées en lab, et la validation complète.
Prérequis : Un serveur Linux with accès root, une connexion internet, et un nom de domaine (ou une IP pour un lab).
Choisir sa méthode d’installation
Section intitulée « Choisir sa méthode d’installation »Avant de commencer, choisissez la méthode adaptée à votre contexte :
| Méthode | Quand l’utiliser | Prérequis |
|---|---|---|
| Linux package (Omnibus) | Self-managed classique, VM ou bare metal | Debian/Ubuntu ou RHEL |
| Helm chart | Cluster Kubernetes déjà opéré en prod | K8s 1.21+, PostgreSQL externe, Object Storage |
| Operator | Gestion K8s déclarative | K8s + CRD GitLab Operator |
| GitLab SaaS | Vous ne voulez pas gérer l’infra | Compte gitlab.com |
| Docker | Dev / test uniquement | Docker Engine |
Ce guide traite uniquement du Linux package (Omnibus) — la méthode la plus répandue et la plus simple à maintenir.
Prérequis système
Section intitulée « Prérequis système »Les prérequis varient selon le nombre d’utilisateurs. Ces valeurs correspondent aux recommandations officielles GitLab :
| Composant | Minimum (lab/démo) | Petit team (≤ 20 users) | Production (≤ 500 users) |
|---|---|---|---|
| CPU | 2 vCPU | 4 vCPU | 8 vCPU+ |
| RAM | 4 Go | 8 Go | 16 Go+ |
| Disque (install) | 40 Go | 60 Go SSD | 100 Go+ SSD |
| Swap | Recommandé (2-4 Go) | Optionnel | Non requis avec 16 Go+ |
Systèmes d’exploitation supportés (package officiel) :
- Ubuntu 22.04, 24.04
- Debian 11, 12, 13
- RHEL / Rocky Linux / AlmaLinux 8, 9
- Amazon Linux 2, 2023
- openSUSE Leap 15.6
Ports à ouvrir :
| Port | Service | Requis |
|---|---|---|
| 80 (HTTP) | Redirection vers HTTPS | Oui |
| 443 (HTTPS) | Interface web et API | Oui (prod) |
| 22 | SSH Git | Si accès SSH aux repos |
Installer GitLab CE
Section intitulée « Installer GitLab CE »-
Mettre le système à jour
Fenêtre de terminal sudo apt-get update && sudo apt-get upgrade -y -
Installer les dépendances
Fenêtre de terminal sudo apt-get install -y curl ca-certificates openssh-server tzdata perl postfixLors de la configuration de
postfix, choisissez “Internet Site” et acceptez le nom de domaine proposé. -
Ajouter le dépôt GitLab
Fenêtre de terminal curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bashCe script ajoute la clé GPG, les sources apt et effectue
apt-get update. -
Installer GitLab CE
Fenêtre de terminal sudo EXTERNAL_URL="http://192.168.1.100" apt-get install -y gitlab-ceRemplacez
192.168.1.100par votre IP ou votre nom de domaine.L’installation prend 10 à 20 minutes — GitLab configure PostgreSQL, Redis, Nginx et Gitaly.
-
Vérifier l’installation
Fenêtre de terminal sudo gitlab-ctl statusRésultat attendu (tous les services
run) :run: alertmanager: (pid 25056) 531s; run: log: (pid 24839) 554srun: gitaly: (pid 24983) 534s; run: log: (pid 23825) 661srun: gitlab-exporter: (pid 25014) 532s; run: log: (pid 24618) 574srun: gitlab-kas: (pid 24277) 651s; run: log: (pid 24296) 650srun: gitlab-workhorse: (pid 24971) 534s; run: log: (pid 24499) 587srun: logrotate: (pid 23697) 677s; run: log: (pid 23749) 674srun: nginx: (pid 24995) 533s; run: log: (pid 24512) 586srun: node-exporter: (pid 25006) 533s; run: log: (pid 24585) 580srun: postgres-exporter: (pid 25067) 530s; run: log: (pid 24876) 549srun: postgresql: (pid 23897) 658s; run: log: (pid 23917) 654srun: prometheus: (pid 25032) 532s; run: log: (pid 24804) 560srun: puma: (pid 24359) 600s; run: log: (pid 24373) 598srun: redis: (pid 23752) 671s; run: log: (pid 23767) 670srun: redis-exporter: (pid 25019) 532s; run: log: (pid 24727) 568srun: sidekiq: (pid 24398) 594s; run: log: (pid 24427) 593sSi un service affiche
down:, consultez la section Dépannage.
-
Mettre le système à jour
Fenêtre de terminal sudo dnf update -y -
Installer les dépendances
Fenêtre de terminal sudo dnf install -y curl ca-certificates openssh-server postfix tzdata perlsudo systemctl enable --now postfix sshd -
Désactiver SELinux (pour l’installation initiale)
Fenêtre de terminal sudo setenforce 0sudo sed -i 's/^SELINUX=enforcing/SELINUX=permissive/' /etc/selinux/config -
Ouvrir les ports firewalld
Fenêtre de terminal sudo firewall-cmd --permanent --add-service=http --add-service=https --add-service=sshsudo firewall-cmd --reload -
Ajouter le dépôt GitLab
Fenêtre de terminal curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash -
Installer GitLab CE
Fenêtre de terminal sudo EXTERNAL_URL="http://192.168.1.100" dnf install -y gitlab-ce -
Vérifier l’installation
Fenêtre de terminal sudo gitlab-ctl status
Première connexion
Section intitulée « Première connexion »-
Récupérer le mot de passe initial
GitLab génère un mot de passe aléatoire pour l’utilisateur
root:Fenêtre de terminal sudo cat /etc/gitlab/initial_root_passwordRésultat :
# WARNING: This password is only valid if ALL of the following are true:# • You set it manually via the GITLAB_ROOT_PASSWORD environment variable# OR the gitlab_rails['initial_root_password'] setting in /etc/gitlab/gitlab.rb# • You set it BEFORE the initial database setup (typically during first installation)# • You have NOT changed the password since then (via web UI or command line)## If this password doesn't work, reset the admin password using:# https://docs.gitlab.com/security/reset_user_password/#reset-the-root-passwordPassword: <mot-de-passe-généré-aléatoirement>=# NOTE: This file is automatically deleted after 24 hours on the next reconfigure run. -
Se connecter à l’interface web
Ouvrez
http://<VOTRE_IP>dans un navigateur.- Identifiant :
root - Mot de passe : la valeur récupérée à l’étape précédente
- Identifiant :
-
Changer le mot de passe root immédiatement
Compte → Preferences → Password — changez le mot de passe dès la première connexion. Ne jamais laisser le mot de passe initial en place.
Validation complète
Section intitulée « Validation complète »Après la première connexion, validez que GitLab est pleinement opérationnel :
# Diagnostic Rails completsudo gitlab-rake gitlab:check SANITIZE=trueUn résultat sain ressemble à :
Checking GitLab subtasks ...Checking GitLab Shell ...GitLab Shell: ... GitLab Shell version >= 14.47.0 ? ... OK (14.47.0)Internal API available: OKRedis available via internal API: OKChecking GitLab Shell ... FinishedChecking Gitaly ...Gitaly: ... default ... OKChecking Gitaly ... FinishedChecking Sidekiq ...Checking Sidekiq ... FinishedChecking Incoming Email ...Checking Incoming Email ... FinishedChecking GitLab App ...Checking GitLab App ... FinishedChecking GitLab subtasks ... FinishedIl est normal d’avoir quelques avertissements (FAILED) liés à la configuration SMTP si vous ne l’avez pas encore configurée.
Fichiers et répertoires importants
Section intitulée « Fichiers et répertoires importants »| Chemin | Contenu |
|---|---|
/etc/gitlab/gitlab.rb | Configuration principale (tous les paramètres) |
/etc/gitlab/gitlab-secrets.json | Secrets chiffrés — ne jamais committer en Git |
/var/opt/gitlab/ | Données GitLab (repos, uploads, DB) |
/var/log/gitlab/ | Logs de tous les services |
/opt/gitlab/ | Binaires et services Omnibus |
# Appliquer les changements de gitlab.rbsudo gitlab-ctl reconfigure
# Redémarrer tous les servicessudo gitlab-ctl restart
# Voir les logs en temps réelsudo gitlab-ctl tail
# Logs d'un service spécifiquesudo gitlab-ctl tail nginxsudo gitlab-ctl tail pumaDépannage problèmes courants
Section intitulée « Dépannage problèmes courants »| Symptôme | Cause probable | Solution |
|---|---|---|
Service puma en down | Manque de RAM | Vérifier free -h, augmenter la RAM ou activer le swap |
502 Whoops, GitLab is taking too long to respond | puma encore en démarrage | Attendre 2-3 min, GitLab démarre lentement après install |
500 We're sorry après reconfigure | Erreur dans gitlab.rb | Vérifier sudo gitlab-ctl tail puma |
| Impossible d’accéder à l’UI (timeout) | Nginx arrêté ou port fermé | sudo gitlab-ctl status nginx + vérifier le firewall |
git clone échoue en SSH | Port 22 non ouvert ou runner de GitLab conflit avec SSH système | Voir configuration GitLab SSH port |
| Page blanche après installation | Base de données pas encore prête | sudo gitlab-rake db:migrate:status |
Commandes de diagnostic utiles :
# État de tous les servicessudo gitlab-ctl status
# Logs en temps réel (Ctrl+C pour quitter)sudo gitlab-ctl tail
# Diagnostic completsudo gitlab-rake gitlab:check SANITIZE=true
# Informations systèmesudo gitlab-rake gitlab:env:infoÀ retenir
Section intitulée « À retenir »- Le package Omnibus est la méthode recommandée : GitLab + toutes ses dépendances en un seul package.
- 8 Go de RAM minimum pour une utilisation réelle — 4 Go suffit pour un lab.
- L’
EXTERNAL_URLdéfinie à l’installation est utilisée partout (emails, webhooks, clones SSH/HTTPS). Changez-la viagitlab.rb+gitlab-ctl reconfigure, pas via variable d’environnement. - Le mot de passe initial root expire après 24h — changez-le à la première connexion.
/etc/gitlab/gitlab-secrets.jsonest aussi important quegitlab.rbpour la restauration — sauvegardez-les ensemble.gitlab-ctl reconfigureprend 2-5 minutes. C’est normal.