How to Install GitLab on Rocky Linux 8

GitLab is a free git repository management tool that allows you to create and manage git repositories. It provides tools for everything an open-source developer would need.

Gitlab has everything that allows a developer to manage their project easily. You can create issues, track your bugs or comments related to your project, keep releases organized, and have much more useful features than the ones you find on GitHub. It integrates perfectly with other development tools like CodeShip, which makes deployments easy and fast.

The difference between GitLab and GitHub is: GitHub is a web-based application while GitLab is an open-source application. GitHub is currently the most popular choice among developers.

Both services are popular for hosting projects of any kind. However, GitHub is more popular among open-source projects. If you search on Google with "GitHub" or "GitLab", GitLab will return almost four times fewer results than GitHub. This doesn't mean that GitLab is not good. GitLab is the better choice for self-hosted private repositories.


To install GitLab on Rocky Linux 8.4, you need to have:

  • A server running Rocky Linux 8.4. If you don't have a server already, you can spin up a cloud server on the web with one of the many providers that provide Rocky Linux VPS's.
  • Root access to the server to install the software.
  • A fully qualified domain name (FQDN)preferably pointing to your server's IP address. A sub-domain will work fine as well.
  • System requirements: according to Gitlab, the current version of GitLab requires at least 2 cores and 8GB of memory (RAM). You need at least 15GB of free space for the bootstrap and the dependencies about the hard disk space.

Updating the System

It's recommended to update your system before installing any new software, especially if you plan to install GitLab. Run the following command to update your system.

sudo dnf check-update
sudo dnf update -y
sudo dnf -y upgrade

Once you have updated your system, you should install the required dependencies. Run the following command to install them.

sudo dnf install -y curl openssh-server policycoreutils perl
sudo systemctl enable --now sshd
sudo dnf -y install postfix
sudo systemctl enable --now postfix
sudo dnf -y install chrony
sudo systemctl enable chronyd

Once the command above finished, run the command below to set your hostname. Because the hostname may be set to localhost by default, and this will create conflicts with other applications that you may install in the future. Remember to replace with your desired FQDN.

sudo hostnamectl set-hostname

You also need to set the correct timezone on your server. Run the following command to list all available time zones.

sudo timedatectl list-timezones

You will get a list of all time zones available on your system as shown below.

 list all available time zones

Choose a time zone that you want to use and run the following command with the corresponding time zone. Remember to replace America/New_York with your time zone. The time-zone configuration parameter will be set in a file under config/gitlab.yml.

sudo timedatectl set-timezone America/New_York

Lastly, configure your chrony as a Network Time Protocol(NTP) server so that you can synchronize the system clock to the servers. Run the following command to do that.

sudo timedatectl set-local-rtc 0
sudo timedatectl set-ntp yes
sudo chronyc sources

Run the timedatectl command without options to check the current status of NTP synchronization.


You will see the status of your NTP synchronization as shown below.

NTP synchronization

Adding GitLab repository

Now it's time to add the official GitLab repository so that you can install GitLab. GitLab has two versions, Community Edition(CE) and Enterprise Edition(EE). We will use the CE version. The GitLab CE is the open-source version that you can use on your own server that's free to download and use. In order to add the GitLab CE repository, run the following command.

sudo tee /etc/yum.repos.d/gitlab_gitlab-ce.repo<<EOL












Now, run the command below to verify whether the GitLab repository has been added or not.

sudo dnf repolist

You will see the gitlab_gitlab-ce as repository as shown below.

gitlab_gitlab-ce as repository

Next, run the following command to verify if the repository is enabled or not.

sudo dnf repolist enabled

You will see an output as shown below.

verify the repository

Do NOT proceed until you see the gitlab_gitlab-ce repository as enabled. Run the command below to set the repository as enabled.

sudo dnf config-manager --set-enabled gitlab_gitlab-ce

Installing GitLab on Rocky Linux 8.4

Now it's time to install GitLab on your system. Run the following command to do so. Replace in the command with your FQDN.

sudo EXTERNAL_URL="" dnf install -y gitlab-ce

The installation might take some time depending on your internet connection speed a the server-loads. You will see the output as shown below after the command finished, don't close the terminal yet because there are still few things to do.

Installing GitLab on Rocky Linux 8.4

Configuring Firewall Rules

Now, it's time to configure the Firewall in Rocky Linux. If you run your server behind a firewall, you need to allow http and https traffic because we will use HTTP/HTTPS protocol to access the GitLab web UI. Run the following command to open HTTP and HTTPS ports on your firewall.

sudo firewall-cmd --permanent --add-service=ssh
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https

Run the command below to apply new firewall rules.

sudo systemctl reload firewalld

Accessing the GitLab Web UI

Now that the installation is complete, you can access the web interface using your FQDN.

Open up your favorite browser and enter FQDN in the address bar. You will see a login page as shown below.

log in page

To log in, you will need a temporary password, which you can get by running the command below in the terminal. This password was created automatically during the installation process but did not show up. The Gitlab developer does this for security reasons.

sudo cat /etc/gitlab/initial_root_password

You will see a password as shown below. Copy and save this password somewhere safe.

Accessing the GitLab Web UI

Now, return to the login page, where you need to enter the username 'root' and the temporary password you copied. Click on Sign In.

 Sign In

Once the login is successful, you will be taken to the Gitlab dashboard as shown below.

Accessing the GitLab Web UI

To change the temporary password, click on Profile and Edit Profile on the top-right. Then click on the Password link on the left-hand side as shown below.

Accessing the GitLab Web UI

You will be taken to the Edit Password page. Provide your current password, your new password and confirm it. Then click on Save password as shown below.

Accessing the GitLab Web UI

You also need to configure the Sign-up restrictions to disable new sign-ups. It's risky if you allow any new users to be able to sign up because then anyone can access your GitLab server. Click on Menu and then go to the Admin area on the top-left as shown below.

Accessing the GitLab Web UI

On the next page, click on Sign up under the Features section as shown below.

On the next page, you will see all the settings for signup restrictions. You can disable new signups by unchecking the Sign-up enabled checkbox. Then click on the Save changes button at the bottom.

Accessing the GitLab Web UI

Accessing the GitLab Web UI

Those steps are just basic configurations. You can configure GitLab further by clicking on the Menu or going to the Setting link. Please refer to the GitLab official documentation for more details. The docs have all the tasks you can do from the web UI.


In this tutorial, we have shown you how to install GitLab on a Rocky Linux 8.4 server. We hope that this tutorial has been helping you to get started with GitLab.

For additional help and support, please visit the official GitLab documentation. If you have any questions or feedback, please comment below.

Share this page:

0 Comment(s)