Guides / Self-Hosted Git

How to Install & Set Up GitLab CE

Install the self-hosted GitLab Community Edition — repos, CI/CD, issues, and a container registry — with the Omnibus package, push your first project, run a pipeline, and schedule backups.

Updated 20269-step setupDownload GitLab CE →

Prerequisites

  • ✓A dedicated host with 4 GB+ RAM (8 GB recommended) and 2+ vCPUs
  • ✓A domain name for the EXTERNAL_URL
  • ✓Ubuntu 22.04 / Debian 12 or a supported RHEL-family OS

What the Omnibus package actually installs

GitLab CE isn't a single process — the Omnibus package bundles GitLab's Rails application together with its own bundled PostgreSQL, Redis, Nginx, and Sidekiq (background job processing) into one self-contained install, all managed as a unit through the gitlab-ctl command. That's what makes the single apt-get install below sufficient: there's no separate database or web server to stand up yourself.

Every setting — the external URL, SSL, SMTP, registry config, resource limits — lives in one file, /etc/gitlab/gitlab.rb. You edit that file and run sudo gitlab-ctl reconfigure to apply it; reconfigure is idempotent and safe to re-run any time you change something.

Install dependencies and add the repo

terminal
sudo apt-get update
sudo apt-get install -y curl openssh-server ca-certificates tzdata perl
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash

Install GitLab with your external URL

terminal
sudo EXTERNAL_URL="https://gitlab.example.com" apt-get install -y gitlab-ce
!

With an https:// EXTERNAL_URL on a public domain, GitLab automatically requests a Let's Encrypt certificate.

Install on RHEL, CentOS Stream, or Fedora

GitLab's installer script comes in matching Debian and RPM flavors — same Omnibus package underneath, just a different package manager driving it.

terminal
sudo dnf install -y curl policycoreutils-python-utils perl
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
sudo EXTERNAL_URL="https://gitlab.example.com" dnf install -y gitlab-ce

Alternative — run GitLab in Docker

terminal
docker run -d --name gitlab \
  --hostname gitlab.example.com \
  -p 80:80 -p 443:443 -p 22:22 \
  -v /srv/gitlab/config:/etc/gitlab \
  -v /srv/gitlab/logs:/var/log/gitlab \
  -v /srv/gitlab/data:/var/opt/gitlab \
  gitlab/gitlab-ce:latest

Log in with the initial root password

Browse to your EXTERNAL_URL and sign in as root with that password (it is auto-deleted after 24 hours).

terminal
sudo cat /etc/gitlab/initial_root_password

Create a project and push your first commit

From the dashboard, New project → Create blank project, then push an existing local repo at it exactly like you would GitHub — GitLab speaks the same Git-over-SSH/HTTPS protocol.

terminal
git remote add origin [email protected]:my-group/my-project.git
git push -u origin main

Run your first CI/CD pipeline

CI/CD isn't a bolted-on integration here — it's built into the same product. Drop a .gitlab-ci.yml at the repo root and GitLab picks it up on the next push, provided a runner is available to execute it (a shared runner is pre-registered on gitlab.com; a self-hosted instance needs at least one gitlab-runner registered against it).

.gitlab-ci.yml
stages: [build, test]

build:
  stage: build
  script:
    - npm ci
    - npm run build

test:
  stage: test
  script:
    - npm test
!

No runner registered yet? Install gitlab-runner on any host and run `gitlab-runner register` — it walks you through pointing it at your instance and a registration token from Settings → CI/CD → Runners.

Back up the instance

GitLab ships its own backup tooling as part of the Omnibus package — it archives the database, repositories, and application data into a single timestamped tarball you can move off-host.

terminal
sudo gitlab-backup create
ls /var/opt/gitlab/backups/
!

The backup tool does not include /etc/gitlab/gitlab.rb or your TLS certificates — back those up separately, since they contain the secrets needed to restore anything at all.

Documentation & Knowledge Base

Official DocumentationGitLab Documentation →Knowledge Base & CommunityGitLab Community Forum →
Download GitLab CE— all versions & official links→

Related Guides

GiteaInstall guide →ForgejoInstall guide →JenkinsInstall guide →

Need GitLab CE deployed and managed for you?

We're OpenStack Dev — we design, deploy, and operate production DevOps infrastructure.

Get in TouchAll Install Guides