Archive · DevOps

Installing GitLab CE on Ubuntu 22.04

A self-managed GitLab using the Omnibus package, with HTTPS and backups.

1 min read

  • GitLab CE 16.8
  • Ubuntu 22.04 LTS

GitLab combines Git hosting, CI/CD and a container registry. Plan for at least 4 GB RAM (8 GB is more comfortable) and 2 or more vCPUs.

sudo apt update && sudo apt install -y curl openssh-server ca-certificates perl
curl 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
sudo cat /etc/gitlab/initial_root_password   # valid for 24 hours

With an https:// URL, Omnibus requests a Let’s Encrypt certificate automatically, provided the DNS name resolves to the server.

After login:

  • Change the root password, and disable sign-up under Admin, Settings, General.
  • Configure SMTP in /etc/gitlab/gitlab.rb, then sudo gitlab-ctl reconfigure.
  • Take a backup, and copy the config files that backups exclude:
sudo gitlab-backup create
sudo cp /etc/gitlab/gitlab-secrets.json /etc/gitlab/gitlab.rb /backup/

Upgrade one minor version at a time (check the upgrade path tool), and read the release notes: GitLab 16.8 was released on 18 January 2024, with 16.9 due on 15 February.