How to Install GitLab on AlmaLinux 9

GitLab is an open-core company that operates GitLab, a DevOps software package that combines the ability to develop, secure, and operate software in a single application.

Note: GitLab requires a minimum of 4GB of system RAM.

In this article, we are going to learn how to install GitLab on AlmaLinux 9. So, let’s get started.

Checkout the GitLab Project Here.

Update the System

Update the available packages to their latest version,

yum update -y 

yum upgrade -y 

Install the Required Packages

Install the required package dependencies,

dnf -y install curl vim policycoreutils python3-policycoreutils git

Add the GitLab CE Repository on AlmaLinux 9

Add the GitLab CE repository using below command,

vim /etc/yum.repos.d/gitlab_gitlab-ce.repo

Add the below lines to the file,

[gitlab_gitlab-ce]
name=gitlab_gitlab-ce
baseurl=https://packages.gitlab.com/gitlab/gitlab-ce/el/8/$basearch
repo_gpgcheck=1
gpgcheck=1
enabled=1
gpgkey=https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey
       https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey/gitlab-gitlab-ce-3D645A26AB9FBD22.pub.gpg
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300

[gitlab_gitlab-ce-source]

name=gitlab_gitlab-ce-source baseurl=https://packages.gitlab.com/gitlab/gitlab-ce/el/8/SRPMS repo_gpgcheck=1 gpgcheck=1 enabled=1 gpgkey=https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey/gitlab-gitlab-ce-3D645A26AB9FBD22.pub.gpg sslverify=1 sslcacert=/etc/pki/tls/certs/ca-bundle.crt metadata_expire=300

After added, verify if the repository has been added,

dnf repolist

Output:

[root@vps ~]# dnf repolist
repo id                                                                  repo name
appstream                                                                AlmaLinux 9 - AppStream
baseos                                                                   AlmaLinux 9 - BaseOS
extras                                                                   AlmaLinux 9 - Extras
gitlab_gitlab-ce                                                         gitlab_gitlab-ce
gitlab_gitlab-ce-source                                                  gitlab_gitlab-ce-source
[root@vps ~]# 

Install the GitLab CE on AlmaLinux 9

After the repositories added, Install GitLab CE on AlmaLinux 9 using below command,

dnf install gitlab-ce -y

Output:

Transaction Summary
==================================================================================================================================================
Install  118 Packages

Total download size: 1.1 G
Installed size: 2.4 G
Downloading Packages:
.
.
It looks like GitLab has not been configured yet; skipping the upgrade script.

       *.                  *.
      ***                 ***
     *****               *****
    .******             *******
    ********            ********
   ,,,,,,,,,***********,,,,,,,,,
  ,,,,,,,,,,,*********,,,,,,,,,,,
  .,,,,,,,,,,,*******,,,,,,,,,,,,
      ,,,,,,,,,*****,,,,,,,,,.
         ,,,,,,,****,,,,,,
            .,,,***,,,,
                ,*,.

     _______ __  __          __
    / ____(_) /_/ /   ____ _/ /_
   / / __/ / __/ /   / __ `/ __ \
  / /_/ / / /_/ /___/ /_/ / /_/ /
  \____/_/\__/_____/\__,_/_.___/

Thank you for installing GitLab!

Configure the GitLab CE on AlmaLinux 9,

Edit the GitLab configuration file which stores in /etc/gitlab/gitlab.rb,

vim /etc/gitlab/gitlab.rb

Edit the below line,

external_url 'http://gitlab.example.com'

Note: Replace gitlab.example.com with your actual domain

Save the file and run the below command to apply changes,

gitlab-ctl reconfigure

Output:

[root@vps ~]# gitlab-ctl reconfigure
[2022-11-15T14:17:52+00:00] INFO: Started Cinc Zero at chefzero://localhost:1 with repository at /opt/gitlab/embedded (One version per cookbook)
Cinc Client, version 17.10.0
Patents: https://www.chef.io/patents
Infra Phase starting
[2022-11-15T14:17:52+00:00] INFO: *** Cinc Client 17.10.0 ***
[2022-11-15T14:17:52+00:00] INFO: Platform: x86_64-linux
[2022-11-15T14:17:52+00:00] INFO: Cinc-client pid: 65882
[2022-11-15T14:17:53+00:00] INFO: Setting the run_list to ["recipe[gitlab]"] from CLI options
[2022-11-15T14:17:53+00:00] INFO: Run List is [recipe[gitlab]]
[2022-11-15T14:17:53+00:00] INFO: Run List expands to [gitlab]
[2022-11-15T14:17:53+00:00] INFO: Starting Cinc Client Run for vps.server.com
[2022-11-15T14:17:53+00:00] INFO: Running start handlers
[2022-11-15T14:17:53+00:00] INFO: Start handlers complete.
.
.
.
.
Warnings:
Environment variable LANG specifies a non-UTF-8 locale. GitLab requires UTF-8 encoding to function properly. Please check your locale settings.
Notes:
Default admin account has been configured with following details:
Username: root
Password: You didn't opt-in to print initial root password to STDOUT.
Password stored to /etc/gitlab/initial_root_password. This file will be cleaned up in first reconfigure run after 24 hours.
NOTE: Because these credentials might be present in your log files in plain text, it is highly recommended to reset the password following https://docs.gitlab.com/ee/security/reset_user_password.html#reset-your-root-password.

gitlab Reconfigured!

After done, check GitLab running status,

gitlab-ctl status

Output:

[root@vps ~]# gitlab-ctl status
run: alertmanager: (pid 69620) 3s; run: log: (pid 67620) 713s
run: gitaly: (pid 69186) 154s; run: log: (pid 66836) 888s
run: gitlab-exporter: (pid 69161) 155s; run: log: (pid 67447) 737s
run: gitlab-kas: (pid 69125) 158s; run: log: (pid 67070) 863s
run: gitlab-workhorse: (pid 69134) 157s; run: log: (pid 67251) 805s
run: logrotate: (pid 66647) 904s; run: log: (pid 66678) 901s
run: nginx: (pid 67297) 799s; run: log: (pid 67312) 797s
run: node-exporter: (pid 69150) 156s; run: log: (pid 67406) 754s
run: postgres-exporter: (pid 69346) 144s; run: log: (pid 67830) 680s
run: postgresql: (pid 66908) 870s; run: log: (pid 66921) 869s
run: prometheus: (pid 69302) 148s; run: log: (pid 67577) 719s
run: puma: (pid 68898) 180s; run: log: (pid 67174) 821s
run: redis: (pid 66694) 898s; run: log: (pid 66732) 895s
run: redis-exporter: (pid 69174) 155s; run: log: (pid 67564) 725s
run: sidekiq: (pid 69168) 155s; run: log: (pid 67197) 816s

You can start,stop GitLab using below command,

gitlab-ctl stop
gitlab-ctl start

Allow Ports on Firewall

Allow the HTTP/HTTPS through the firewall,

firewall-cmd --permanent --zone=public --add-service=http

firewall-cmd --permanent --zone=public --add-service=https

firewall-cmd --reload

Access GitLab Web Console

You can access visit GitLab browser using the provided URL http://Your_Domain_Name.

For password, you can obtain using below command,

cat /etc/gitlab/initial_root_password

Output:

[root@vps ~]# cat /etc/gitlab/initial_root_password
# WARNING: This value is valid only in the following conditions
#          1. If provided manually (either via `GITLAB_ROOT_PASSWORD` environment variable or via `gitlab_rails['initial_root_password']` setting in `gitlab.rb`, it was provided before database was seeded for the first time (usually, the first reconfigure run).
#          2. Password hasn't been changed manually, either via UI or via command line.
#
#          If the password shown here doesn't work, you must reset the admin password following https://docs.gitlab.com/ee/security/reset_user_password.html#reset-your-root-password.

Password: eMMwu4e8UJN2f/+IKS1KCBAp1dTfmGMet2maOAewPg8=

# NOTE: This file will be automatically deleted in the first reconfigure run after 24 hours.
[root@vps ~]# 

The dashboard will look like this,

You can change your password here,

Done.

Related posts

How to Create Remote Desktop Gateway via Apache Guacamole on AlmaLinux 9

How to Secure Nginx with Let’s Encrypt on AlmaLinux 9

How to Install Glances on AlmaLinux 8