How To Install GitLab on Rocky Linux 9

Install GitLab on Rocky Linux 9

In this tutorial, we will show you how to install GitLab on Rocky Linux 9. For those of you who didn’t know, GitLab is a free git repository management tool that allows you to create and manage git repositories. With GitLab, you can host your own internal repository for a development team and allow users to host their projects.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of GitLab on Rocky Linux. 9.


  • A server running one of the following operating systems: Rocky Linux 9.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • SSH access to the server (or just open Terminal if you’re on a desktop).
  • A non-root sudo useror access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install GitLab on Rocky Linux 9

Step 1. The first step is to update your system to the latest version of the package list. To do so, run the following commands:

sudo dnf check-update
sudo dnf install dnf-utils curl policycoreutils perl

Step 2. Installing Postfix.

Now we install the Postfix package, which we need to handle emails:

sudo dnf install postfix

Next, start the service and make it start with the system:

sudo systemctl enable --now postfix
sudo systemctl start postfix

Step 3. Installing GitLab on Rocky Linux 9.

By default, GitLab is not available on Rocky Linux 9 base repository. So you will need to add the GitLab repository to the system:

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

Add the following file:



Once the repository has been created, now we install the Gitlab community edition with the following command:

sudo dnf install gitlab-ce


It looks like GitLab has not been configured yet; skipping the upgrade script.

       *.                  *.
      ***                 ***
     *****               *****
    .******             *******
    ********            ********

     _______ __  __          __
    / ____(_) /_/ /   ____ _/ /_
   / / __/ / __/ /   / __ `/ __ \
  / /_/ / / /_/ /___/ /_/ / /_/ /

Thank you for installing GitLab!
GitLab was unable to detect a valid hostname for your instance.
Please configure a URL for your GitLab instance by setting `external_url`
configuration in /etc/gitlab/gitlab.rb file.
Then, you can start your GitLab instance by running the following command:
  sudo gitlab-ctl reconfigure

Step 4. Configure GitLab.

Now configure it by editing /etc/gitlab/gitlab.rb file:

external_url ''
gitlab_rails['initial_root_password'] = 'Your-GitLab-Passwd'

Save  and close the file, then apply the changes using the command below:

sudo gitlab-ctl reconfigure

Step 5. Configure Firewall Rules.

GitLab listens on port 80 by default, now allow it through the firewall as shown:

sudo firewall-cmd --permanent --add-service=ssh
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo systemctl reload firewalld

Step 6. Accessing Gitlab Web Interface.

Once successfully installed, you can access GitLab CE web UI by visiting the URL You will see the following page:

Install GitLab on Rocky Linux 9

You can check the access password using the following command:

cat /etc/gitlab/initial_root_password

You should get the following output:

Password: w5hNDOCgqHmv+ZNMdfeOcMeilanaXlh39bbloli3jVpBA=

Congratulations! You have successfully installed GitLab. Thanks for using this tutorial for installing GitLab on your Rocky Linux 9 system. For additional help or useful information, we recommend you check the official GitLab website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!