GitLab Self Managed Setup

A self-managed GitLab runs on a server that your organization controls. You choose the hardware, the network, and the update schedule. Companies pick this path to keep code inside private networks or to meet internal data rules.

Think of renting an apartment versus owning a house. GitLab.com is the apartment: the landlord handles repairs. A self-managed install is the house: you hold the keys and handle the maintenance.

GitLab.com and Self-Managed Compared

FeatureGitLab.comSelf-Managed
HostingGitLab runs the serversYou run the servers
UpdatesAutomaticYou schedule them
Data locationGitLab cloudYour own network
Admin accessLimited to group settingsFull control of the instance
BackupsHandled by GitLabYour responsibility

Installation Methods

MethodBest For
Linux packageMost teams; the recommended starting point
DockerQuick trials and container-based setups
Helm chartKubernetes clusters
Source installSpecial cases that need full manual control

Plan the Server

Resource needs grow with the number of users and the size of the repositories. A small team starts with at least four CPU cores and eight gigabytes of memory. The official documentation lists exact figures for larger groups.

  • Choose a supported Linux system such as Ubuntu, Debian, or Rocky Linux.
  • Reserve a fixed IP address and a domain name such as gitlab.example.com.
  • Open ports 80 and 443 for web traffic and port 22 for Git over SSH.
  • Provide fast disk storage, because repositories read and write constantly.

Architecture at a Glance

  Developer browser / Git client
              │
              ▼
  ┌──────────────────────────────────────────────┐
  │  Your Server                                 │
  │  ┌────────┐  ┌─────────┐  ┌───────────────┐  │
  │  │ NGINX  │→ │ GitLab  │→ │ PostgreSQL    │  │
  │  │ web    │  │ Rails   │  │ database      │  │
  │  └────────┘  └────┬────┘  └───────────────┘  │
  │                   │       ┌───────────────┐  │
  │                   ├─────→ │ Redis cache   │  │
  │                   │       └───────────────┘  │
  │                   └─────→ Gitaly (repo files)│
  └──────────────────────────────────────────────┘

The Linux package bundles every part, so one installer sets up the whole stack.

Install with the Linux Package

  1. Add the official GitLab package repository by following the commands on the GitLab install page for your operating system.
  2. Install the package and set your address in the same command.
sudo EXTERNAL_URL="https://gitlab.example.com" apt-get install gitlab-ee

Use the gitlab-ce package name for the free Community Edition.

Sign In for the First Time

The installer creates an administrator account named root. A random password lives in a local file.

sudo cat /etc/gitlab/initial_root_password

Open your GitLab address in a browser, sign in as root, and change the password immediately. GitLab deletes the file after twenty-four hours.

Main Configuration File

Settings live in /etc/gitlab/gitlab.rb. Edit the file and apply the change with the command below.

# /etc/gitlab/gitlab.rb
external_url 'https://gitlab.example.com'
gitlab_rails['gitlab_email_from'] = 'gitlab@example.com'
letsencrypt['enable'] = true
sudo gitlab-ctl reconfigure

The reconfigure command rewrites internal settings and restarts the affected services.

Everyday Control Commands

CommandPurpose
sudo gitlab-ctl statusShow the state of each service
sudo gitlab-ctl restartRestart all services
sudo gitlab-ctl tailStream live logs
sudo gitlab-rake gitlab:checkRun a health check
sudo gitlab-rake gitlab:env:infoPrint version and environment details

First Tasks After Installation

  • Disable open sign-up under Admin Area → Settings → General unless you want public registration.
  • Configure outgoing email so GitLab sends notifications and password resets.
  • Create groups and invite users.
  • Register at least one runner for pipelines.
  • Schedule backups before anyone stores real work.

Update Safely

GitLab publishes monthly releases. Read the upgrade path tool on the official site before each update, because some versions require stops along the way.

sudo apt-get update
sudo apt-get install gitlab-ee

Back up data, test the update on a copy of the server, and schedule the real update outside working hours.