GitLab Community Edition is a complete, self-hosted DevOps platform: Git repositories, merge requests, issues, CI/CD, container and package registries, wikis and more. The official Omnibus package bundles everything — PostgreSQL, Redis, Nginx, Puma, Sidekiq, Gitaly — and configures it from a single file.
Sizing: GitLab is heavy
GitLab’s minimum is 4 GB RAM (8 GB recommended) and 4 vCPU for a small team. On less memory it becomes slow or unstable. If that’s more than you need, Gitea or Forgejo provide Git hosting, code review and CI in a few hundred megabytes.
Disk: plan for repositories, CI artifacts, container images and backups — 50 GB+ to start.
1. Install dependencies
sudo apt update
sudo apt install -y curl openssh-server ca-certificates tzdata perl
For outgoing email, GitLab can use an external SMTP server (configured below) — no local mail server needed.
2. Add the repository and install
curl -fsSL https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
sudo EXTERNAL_URL="https://gitlab.example.com" apt install -y gitlab-ce
With an https:// URL, the installer requests a Let’s Encrypt certificate automatically — the domain must point to the server and ports 80/443 must be open:
sudo ufw allow http && sudo ufw allow https && sudo ufw allow OpenSSH
Installation takes several minutes.
3. First login
The initial root password is stored temporarily (deleted after 24 hours):
sudo cat /etc/gitlab/initial_root_password
Log in at https://gitlab.example.com as root, then immediately:
- change the root password and enable 2FA;
- create your personal admin account;
- Admin → Settings → General → Sign-up restrictions: disable sign-up, or require admin approval and restrict to your email domain. Open sign-up on a public GitLab invites spam accounts.
4. The configuration file
Everything is configured in /etc/gitlab/gitlab.rb. After any change:
sudo gitlab-ctl reconfigure
Email via SMTP
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.example.com"
gitlab_rails['smtp_port'] = 587
gitlab_rails['smtp_user_name'] = "[email protected]"
gitlab_rails['smtp_password'] = "smtp-password"
gitlab_rails['smtp_domain'] = "example.com"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['gitlab_email_from'] = '[email protected]'
Test: sudo gitlab-rails console, then Notify.test_email('[email protected]', 'Test', 'Hello').deliver_now.
Reduce memory on a small server
For a 4 GB server with a small team:
puma['worker_processes'] = 2
sidekiq['concurrency'] = 10
prometheus_monitoring['enable'] = false
gitlab_rails['env'] = { 'MALLOC_CONF' => 'dirty_decay_ms:1000,muzzy_decay_ms:1000' }
Disabling the bundled Prometheus monitoring stack saves several hundred MB. Add swap as a safety net — see swap file vs partition.
SSH on a different port
If the server’s SSH runs on a non-standard port, tell GitLab so clone URLs are correct:
gitlab_rails['gitlab_shell_ssh_port'] = 2222
5. Everyday commands
sudo gitlab-ctl status
sudo gitlab-ctl restart
sudo gitlab-ctl tail # all logs
sudo gitlab-ctl tail nginx
sudo gitlab-rake gitlab:check SANITIZE=true
sudo gitlab-rake gitlab:env:info
6. Backups
sudo gitlab-backup create
Backups go to /var/opt/gitlab/backups/. They do not include configuration and secrets — back those up separately:
sudo tar czf gitlab-config-$(date +%F).tar.gz /etc/gitlab/gitlab.rb /etc/gitlab/gitlab-secrets.json
Without gitlab-secrets.json, encrypted data (CI variables, 2FA secrets) can’t be restored. Schedule both with cron and copy them off the server. Set retention:
gitlab_rails['backup_keep_time'] = 604800 # 7 days
7. Upgrades
GitLab requires following an upgrade path — you can’t jump many major versions at once. Check the official Upgrade Path tool, then:
sudo gitlab-backup create
sudo apt update && sudo apt install gitlab-ce=<target-version>
Upgrade regularly; GitLab releases monthly with frequent security fixes.
8. CI/CD runners
Run GitLab Runner on separate servers, not the GitLab host — CI jobs consume CPU and RAM and execute untrusted code. See installing GitLab Runner and GitLab CI deploys over SSH.
Gitea vs GitLab
| GitLab CE | Gitea / Forgejo | |
|---|---|---|
| RAM | 4–8 GB+ | 200–500 MB |
| Features | Full DevOps platform | Git hosting, PRs, issues, Actions CI, packages |
| Admin effort | Higher | Low |
Our VPS plans with 8 GB RAM or more give GitLab room to run smoothly — see USA, Hong Kong or Japan plans.