How to install and set up Gitlab CE Server on Alma/Rocky Linux 9

Pinterest LinkedIn Tumblr

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 9 server. We will install the GitLab CE using the ‘omnibus’ package provided by GitLab.

Related content:


  • Updated Rocky Linux 9 server
  • Access to the internet
  • Ensure that your server is at lease 4GB of RAM with more than 20GB of disk space and 2 CPUs

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 pakages needed are installed. Use this command:

sudo dnf install -y curl policycoreutils openssh-server perl

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

sudo systemctl start sshd
sudo systemctl enable sshd

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

sudo firewall-cmd --permanent --add-service={ssh,http,https} --permanent 
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 postfix
sudo systemctl start 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/ (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/ 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 | 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 domai to point to the server where you are installing Gitlab. Installation will automatically configure and start GitLab at that URL.

sudo EXTERNAL_URL="" 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 ''

Save & 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 in the URL provided (In my case 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 as shown below:

Gitlab CE Sign in Page

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

sudo cat /etc/gitlab/initial_root_password

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


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!

I am a Devops Engineer, but I would describe myself as a Tech Enthusiast who is a fan of Open Source, Linux, Automations, Cloud and Virtualization. I love learning and exploring new things so I blog in my free time about Devops related stuff, Linux, Automations and Open Source software. I can also code in Python and Golang.

Write A Comment