RHEL BasedRocky Linux

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 Git repository management on Rocky Linux. 9.

Prerequisites

  • 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).
  • An active internet connection. You’ll need an internet connection to download the necessary packages and dependencies.
  • A non-root sudo user or 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:

[gitlab_gitlab-ce]
name=gitlab_gitlab-ce
baseurl=https://packages.gitlab.com/gitlab/gitlab-ce/el/8/$basearch
repo_gpgcheck=1
gpgcheck=1
enabled=1
gpgkey=https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey
       https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey/gitlab-gitlab-ce-3D645A26AB9FBD22.pub.gpg
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300

[gitlab_gitlab-ce-source]
name=gitlab_gitlab-ce-source
baseurl=https://packages.gitlab.com/gitlab/gitlab-ce/el/8/SRPMS
repo_gpgcheck=1
gpgcheck=1
enabled=1
gpgkey=https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey
       https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey/gitlab-gitlab-ce-3D645A26AB9FBD22.pub.gpg
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300

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

sudo dnf install gitlab-ce

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

Step 4. Configure GitLab.

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

external_url 'http://gitlab.idroot.us'
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

Recheck the status of the firewall:

sudo firewall-cmd --zone=public --list-all

Step 6. Accessing Gitlab Web Interface.

Once successfully installed, you can access GitLab CE web UI by visiting the URL http://gitlab.idroot.us. 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 Git repository management 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!

r00t

r00t is a seasoned Linux system administrator with a wealth of experience in the field. Known for his contributions to idroot.us, r00t has authored numerous tutorials and guides, helping users navigate the complexities of Linux systems. His expertise spans across various Linux distributions, including Ubuntu, CentOS, and Debian. r00t's work is characterized by his ability to simplify complex concepts, making Linux more accessible to users of all skill levels. His dedication to the Linux community and his commitment to sharing knowledge makes him a respected figure in the field.
Back to top button