On this tutorial, we will look at how to install and Configure GitLab on RHEL / CentOS Stream. Version control is a system that records changes made to a file so that a specific version can be rolled back if needed. It keeps all the team members on the same page by making sure they simultaneously work on the latest version of the file. It helps in managing and protecting the source code by keeping track of all modifications made to the code. It helps different users collaborate while storing different versions on the repository, provides backup, and is easy to restore a previous version. Some of the best version control systems include GitHub, GitLab, AWS CodeCommit, Perforce, Mercurial, Concurrent Version Control (CVS), Bitbucket, and Beanstalk.


GitLab is a software package that allows you to host your project on a remote repository with additional features that cover all stages of the Software Development Life Cycle (SDLC), Continuous Integration(CI), and Continuous Delivery (CD) of a project. The services include, Manage Software delivery, Planning to meet the needs of team members, and creating, viewing, Bug tracking, and managing code. It helps package your application and it’s dependencies with ease, deliver secure applications with license compliance, and configure and monitor your applications while setting up policies to protect your software from vulnerabilities.

Some of the Key features of GitLab include;

  • GitLab provides all essentials of DevOps tools in one platform. These reduce development costs, speed up time to market, and deliver more secure and compliant applications.
  • GitLab provides a platform for all users to collaborate. These include the Dev, Sec, Ops, and everyone else who is working on your code including non-technical teams.
  • You can choose between Software as a System and Self-managed options. SaaS does not require you to install anything, You just create an account and start using GitLab. Self-managed allows one to deploy an instance on Cloud or on-premises, this involves installing, administering, and maintaining the instance. Both options can run on free and paid options which are, Premium and Ultimate.
  • GitLab is open-source software, this allows you to benefit from improvements from thousands of developers that add and refine innovations.
  • GitLab provides Static Application Security Testing (SAST), Dynamic Application Security Testing (DAST), Container Scanning, and Dependency Scanning to help you deliver secure applications along with license compliance before deploying using open source tools installed as part of GitLab.
  • GitLab integrates Continuous Delivery (CD) solution that ships your code with zero-touch, shortening the delivery lifecycle, streamlining manual processes, and accelerating team velocity.

We are going to see how to Install and Configure GitLab on RHEL 9 / CentOS Stream 9.

Install GitLab on RHEL 9 / CentOS Stream 9

Update your system packages

sudo dnf update -y

First, we need to install GitLab dependencies using the following command.

sudo dnf install -y curl policycoreutils perl

Configure the Firewall to allow HTTP and HTTPS services.

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

Install, start and enable Postfix to send notification emails.

sudo dnf install postfix
sudo systemctl enable postfix
sudo systemctl start postfix

Check the status of Postfix

$ sudo systemctl status postfix
● postfix.service - Postfix Mail Transport Agent
     Loaded: loaded (/usr/lib/systemd/system/postfix.service; enabled; vendor p>
     Active: active (running) since Thu 2022-08-18 20:18:38 EAT; 1min 0s ago
    Process: 10744 ExecStartPre=/usr/sbin/restorecon -R /var/spool/postfix/pid/>
    Process: 10745 ExecStartPre=/usr/libexec/postfix/aliasesdb (code=exited, st>
    Process: 10749 ExecStartPre=/usr/libexec/postfix/chroot-update (code=exited>
    Process: 10750 ExecStart=/usr/sbin/postfix start (code=exited, status=0/SUC>
   Main PID: 10818 (master)
      Tasks: 3 (limit: 48771)
     Memory: 4.9M
        CPU: 304ms
     CGroup: /system.slice/postfix.service
             ├─10818 /usr/libexec/postfix/master -w
             ├─10819 pickup -l -t unix -u
             └─10820 qmgr -l -t unix -u

Add the GitLab repository to the system.

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



Then install the Gitlab community edition with the following command.

$ sudo dnf install gitlab-ce -y

## sample Output ##
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

Configure GitLab on RHEL 9|CentOS 9

Set up your DNS to the URL at which you want to access your GitLab instance.

sudo hostnamectl set-hostname gitlab.technixleo.com

To change the GitLab URL access, edit the configuration file.

sudo vi /etc/gitlab/gitlab.rb

Change the external URL to your domain name.

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

You can set a password for the initial administrator user account (root).

gitlab_rails['initial_root_password'] = 'GitLabPassWord'

Save and exit the file.

Reconfigure the instance to save changes.

sudo gitlab-ctl reconfigure

Secure GitLab with SSL

We can secure GitLab with a Self-signed certificate or a Let’s Encrypt certificate.

Self-signed Certificate

Create the following directory to generate a self-signed certificate and set appropriate permissions.

sudo mkdir -p /etc/gitlab/ssl
sudo chmod 755 /etc/gitlab/ssl

Generate the self-signed certificate and store it in the directory with the following command.

sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/gitlab/ssl/gitlab.technixleo.com.key -out /etc/gitlab/ssl/gitlab.technixleo.com.crt

Edit the configuration file to provide the SSL certificate paths.

$ sudo vi /etc/gitlab/gitlab.rb

nginx['enable'] = true
nginx['client_max_body_size'] = '250m'
nginx['redirect_http_to_https'] = true

nginx['ssl_certificate'] = "/etc/gitlab/ssl/gitlab.technixleo.com.crt"
nginx['ssl_certificate_key'] = "/etc/gitlab/ssl/gitlab.technixleo.com.key"
nginx['ssl_protocols'] = "TLSv1.1 TLSv1.2 TLSv1.3"

Reconfigure your instance to apply the changes.

sudo gitlab-ctl reconfigure

Let’s Encrypt certificate

Edit the GitLab configuration file with the following settings.

$ sudo vi /etc/gitlab/gitlab.rb

letsencrypt['enable'] = true
letsencrypt['contact_emails'] = ['[email protected]'] # This should be an array of email addresses to add as contacts
letsencrypt['auto_renew'] = true

Save and exit the file.

Then reconfigure the instance to apply changes

sudo gitlab-ctl reconfigure

GitLab Post-Installation steps

Open the browser and type in your URL in my case, gitlab.technixleo.com and you will be redirected to the HTTPS connection. You can sign in with the password set on the file.

The dashboard appears as shown below.

Under Profile settings. You have options to edit the profile, set status, or change preferences.

You can set a Public Avatar to a different one, Edit status, Change time zone, edit profile name, and more.

Under the Account Tab, you can enable Two-factor authentication, change the username, and delete the account.

In the Password section, you can change the password to a different password from the current one. You will be logged out and required to sign in with the new Password.

You can also change the color theme to a different one under the Prefences section.

On the Menu Icon, you can further customize the Admin settings.

Clicking on Admin will open the dashboard that give you an overview of the instance created.

On the settings Tab, you can set other Admin options

Set Projects and maximum size limits, user options, and session duration. Click on save changes to apply the settings.

Restrict Sign up for users. deselect the checkbox that enables sign-up as shown below under Sign-up restrictions settings. Click on save changes to apply the settings.

Create A project on GitLab

To create a project on Gitlab, Go to the Dashboard and click on New Project.

There are 3 options available to create a project

  • Create a blank project from scratch
  • Create a template with populated files to start your instance.
  • Import a project from external sources like GitHub or Bitbucket.

I will create a simple blank project.

Name your Project, You can add a description of the project or its purpose(optional) and also set the visibility level of the project. Click on Create Project to create one.

The newly created project appears as shown below.


From this guide, we have installed and configured GitLab on RHEL 9| CentOS 9. The GitLab platform offers different services for the Software Development Life Cycle (SDLC). Applications may be deployed with CI/CD tools, secure code is shipped more quickly, any cloud can be used, and business results are driven. With security built-in, this enhances collaboration on a single platform from planning through production. Check below for some of our articles;


Please enter your comment!
Please enter your name here