1 minute read

GitLab CE at Home Lab — Quick Note

A simple GitLab Community Edition installation on AlmaLinux 9.

1. Install GitLab CE

Set the hostname:

hostnamectl set-hostname gitlab.home.lab

Install required packages:

dnf update -y
dnf install -y curl openssh-server
systemctl enable --now sshd

Open firewall:

firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-service=ssh
firewall-cmd --reload

Add the GitLab CE repository:

curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | bash

Install GitLab:

EXTERNAL_URL="http://gitlab.home.lab" dnf install -y gitlab-ce

Check services:

gitlab-ctl status

GitLab configuration is stored mainly in:

/etc/gitlab/gitlab.rb

2. Configure / Reconfigure GitLab

Edit configuration:

vi /etc/gitlab/gitlab.rb

For example:

external_url 'http://gitlab.home.lab'

After any configuration change, apply it with:

gitlab-ctl reconfigure

Check:

gitlab-ctl status

Example: Change External URL

Change:

external_url 'http://gitlab.home.lab'

to:

external_url 'https://gitlab.home.lab'

Then:

gitlab-ctl reconfigure

Important concept

/etc/gitlab/gitlab.rb
        ↓
gitlab-ctl reconfigure
        ↓
GitLab generates/applies service configuration

So:

Edit gitlab.rb → run gitlab-ctl reconfigure.


3. Change Root Password with Rails Console

Start the GitLab Rails console:

[root@gitlab ~]# gitlab-rails console
--------------------------------------------------------------------------------
 Ruby:         ruby 3.3.12 (2026-07-16 revision 0581089df9) [x86_64-linux]
 GitLab:       19.4.1 (191678a3764) FOSS
 GitLab Shell: 14.57.3
 PostgreSQL:   17.11
------------------------------------------------------------[ booted in 38.77s ]
Loading production environment (Rails 7.2.3.1)

Find the root user:

gitlab(prod)> u = User.find_by_username('root')
=> #<User id:1 @root>

Set the new password:

gitlab(prod)> u.password = 'Gitlab123'
=> "Gitlab123"
gitlab(prod)> u.password_confirmation = 'Gitlab123'
=> "Gitlab123"

Verify the password:

gitlab(prod)> u.save!(validate: false)
=> true

Reload configuration:

gitlab(prod)> u.reload
=> #<User id:1 @root>

Validate new password:

gitlab(prod)> u.valid_password?('Gitlab123')
=> true

Login:

URL:      http://gitlab.home.lab
Username: root
Password: Gitlab123

Useful Commands

# Status
gitlab-ctl status

# Apply configuration
gitlab-ctl reconfigure

# Restart GitLab
gitlab-ctl restart

# Start
gitlab-ctl start

# Stop
gitlab-ctl stop

# Rails console
gitlab-rails console

# Main configuration
vi /etc/gitlab/gitlab.rb

Mental model

GitLab package
     │
     ├── /etc/gitlab/gitlab.rb     ← configuration
     │
     ├── gitlab-ctl                ← administration
     │
     └── gitlab-rails console      ← GitLab application/database