How to Install GitLab CE Server on Rocky/Alma Linux 8

Install and set up GitLab CE server on Rocky and Alma Linux 8 using the official omnibus package to host your own self-managed on-premise Git repository.

GitLab allows you to host an on-premise Git repository that can be accessed from either your local LAN or (if you have an available public IP address) from outside your company. GitLab is an open-source repository manager based on Rails developed by GitLab Inc. It is a web-based git repository manager that allows your team to collaborate on coding, testing, and deploying applications. GitLab provides several features, including wikis, issue tracking, code reviews, and activity feeds.

In this guide, we will install the GitLab CE on a Rocky/Alma Linux 8 server. We will install the GitLab CE using the ‘omnibus’ package provided by GitLab.

On EL8 in 2026: GitLab still ships official EL8 packages, and Rocky Linux 8, AlmaLinux 8 and RHEL 8 are all supported until 31 May 2029. Enterprise Linux 8 has been in maintenance-only support since May 2024, though, so for a brand-new deployment prefer EL9 or EL10 — see the Rocky/Alma Linux 9 guide below.

Related content:

Prerequisites

  • Updated Rocky Linux 8 or AlmaLinux 8 server
  • Access to the internet
  • A server with at least 4GB of RAM, 4 CPU cores and 20GB of free disk space. GitLab’s official requirements put 4 cores and 4GB as the practical floor for a small instance (up to ~500 users); 8GB is far more comfortable once CI runners and container registry come into play.
  • A DNS record pointing at the server if you plan to use a custom domain (required for the automatic Let’s Encrypt certificate)

Ensure that the server packages are up to date

Before proceeding let us update our Rocky Linux server using this command:

sudo dnf -y update

Install common packages that will be essential

sudo dnf install -y vim

Install and configure the necessary dependencies

Before proceeding let’s ensure that the packages needed are installed. Use this command:

sudo dnf install -y curl policycoreutils openssh-server perl

Current GitLab docs only require curl plus a running SSH server — policycoreutils, openssh-server and perl are already present on a standard Rocky/Alma install. Keeping them in the command is harmless and makes the guide safe to run on a minimal image.

Next, ensure that the ssh server is started and enabled to start on boot:

sudo systemctl enable --now sshd

If you have firewall enabled, open up http and https traffic using this command:

sudo firewall-cmd --permanent --add-service={ssh,http,https}
sudo firewall-cmd --reload

Our Gitlab CE server will be sending emails. Let us install postfix for this purpose:

sudo dnf install -y postfix

Then let’s enable and start the service:

sudo systemctl enable --now postfix

Confirm that postfix was installed and started successfully:

$ sudo systemctl status postfix

● postfix.service - Postfix Mail Transport Agent
     Loaded: loaded (/usr/lib/systemd/system/postfix.service; enabled; vendor preset: disabled)
     Active: active (running) since Tue 2022-10-25 06:20:58 UTC; 34s ago
    Process: 543665 ExecStartPre=/usr/sbin/restorecon -R /var/spool/postfix/pid/master.pid (code=exited, status=255/EXCEPTION)
    Process: 543666 ExecStartPre=/usr/libexec/postfix/aliasesdb (code=exited, status=0/SUCCESS)
    Process: 543670 ExecStartPre=/usr/libexec/postfix/chroot-update (code=exited, status=0/SUCCESS)
    Process: 543671 ExecStart=/usr/sbin/postfix start (code=exited, status=0/SUCCESS)
   Main PID: 543739 (master)
      Tasks: 3 (limit: 21385)
     Memory: 5.0M
        CPU: 450ms
     CGroup: /system.slice/postfix.service
             ├─543739 /usr/libexec/postfix/master -w
             ├─543740 pickup -l -t unix -u
             └─543741 qmgr -l -t unix -u

Oct 25 06:20:57 unstable-rockysrv systemd[1]: Starting Postfix Mail Transport Agent...
Oct 25 06:20:57 unstable-rockysrv restorecon[543665]: /usr/sbin/restorecon: lstat(/var/spool/postfix/pid/master.pid) failed: No such file or directory
Oct 25 06:20:58 unstable-rockysrv postfix/postfix-script[543737]: starting the Postfix mail system
Oct 25 06:20:58 unstable-rockysrv postfix/master[543739]: daemon started -- version 3.5.9, configuration /etc/postfix
Oct 25 06:20:58 unstable-rockysrv systemd[1]: Started Postfix Mail Transport Agent.

Add the GitLab package repository and install the package

Add the GitLab package repository.

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

Next, install the GitLab package. We will use a custom domain to access our Gitlab instance. Ensure that you have mapped the DNS records for your domain to point to the server where you are installing Gitlab. Installation will automatically configure and start GitLab at that URL.

sudo EXTERNAL_URL="https://gitlab.citizix.com" dnf install -y gitlab-ce

When EXTERNAL_URL uses https://, GitLab automatically requests a Let’s Encrypt certificate for that hostname during the install. For that to succeed the domain must already resolve to this server and inbound port 80 must be reachable from the internet — which is why we opened http in the firewall earlier.

If the instance is internal-only (a LAN address, no public DNS, or an air-gapped network), use a plain http:// URL instead and terminate TLS yourself later:

sudo EXTERNAL_URL="http://gitlab.citizix.com" dnf install -y gitlab-ce

Configuring Gitlab CE

Now that gitlab is successfully installed, let’s configure it. The main configuration file can be found in the file /etc/gitlab/gitlab.rb. Open the file (vim /etc/gitlab/gitlab.rb) and confirm that the external url is set as defined during installation:

external_url 'https://gitlab.citizix.com'

Save the file and run the reconfiguration script

sudo gitlab-ctl reconfigure

Wait for the configuration script to finish. You should see something similar to this:

Recipe: gitlab::database_reindexing_disable
  - crond_job[database-reindexing] action delete
    - file[/var/opt/gitlab/crond/database-reindexing] action delete (up to date)
     (up to date)
[2022-10-25T06:56:12+00:00] INFO: Cinc Client Run complete in 23.97298455 seconds

Running handlers:
[2022-10-25T06:56:12+00:00] INFO: Running report handlers
Running handlers complete
[2022-10-25T06:56:12+00:00] INFO: Report handlers complete
Infra Phase complete, 0/776 resources updated in 30 seconds
gitlab Reconfigured!

Accessing Gitlab CE

Once the configuration is complete, Gitlab CE is available at the URL provided (in my case https://gitlab.citizix.com). Ensure that the DNS entry for the URL is pointing to the server, then access that url in the browser. You should be redirected to the login page.

Unless you provided a custom password during installation, a password will be randomly generated and stored in /etc/gitlab/initial_root_password. Use this password with username root to login.

sudo cat /etc/gitlab/initial_root_password

Log in and change this password within 24 hours. GitLab deletes /etc/gitlab/initial_root_password automatically after 24 hours for security reasons. If you miss the window, reset the password from the server with sudo gitlab-rake "gitlab:password:reset[root]".

Once logged in you can use the gitlab server to create and manage projects and repositories.

Conclusion

Congratulations, you now have your local GitLab up and running. You can now use your Gitlab CE Server to manage repositories and projects.

Have fun!

comments powered by Disqus
Citizix Ltd
Built with Hugo
Theme Stack designed by Jimmy