Atlantic.Net Blog

How to Install GitLab on Rocky Linux 8

Hitesh Jethva
by Atlantic.Net (345 posts) under Dedicated Server Hosting, Tutorials
0 Comments

GitLab is a free, open-source, and web-based Git repository manager and DevOps tool. It comes with a lot of features including issue tracking, continuous integration, deployment pipeline, and more. It offers two editions, the Enterprise Edition and the Community Edition. It is an alternative to GitHub that supports integration with various services. With GitLab, you can host your own internal repository for a development team and allow users to host their projects.

In this post, we will show you how to install the GitLab community edition on Rocky Linux 8.

Prerequisites

  • A server running RockyLinux 8 on the Atlantic.Net Cloud Platform
  • A root password is configured on your server

Step 1 – Create Atlantic.Net Cloud Server

First, log in to your Atlantic.Net Cloud Server. Create a new server, choosing Rocky Linux 8 as the operating system with at least 4GB RAM. Connect to your Cloud Server via SSH and log in using the credentials highlighted at the top of the page.

Once you are logged in to your server, run the following command to update your base system with the latest available packages.

dnf update -y

Step 2 – Install Postfix

Before starting, you will need to install the Postfix package on your server. You can install it using the following command:

dnf install postfix

Once Postfix is installed, start the Postfix service and enable it to start at system reboot:

systemctl enable --now postfix

Step 3 – Add GitLab CE Repository

By default, GitLab is not included in the Rocky Linux default repo, so you will need to add a repository from the GitLab installation script.

First, download the script from the GitLab using the following command:

wget https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh

Once the download is completed, set execution permissions with the following command:

chmod +x script.rpm.sh

Next, run the script to add the GitLab CE repository.

os=el dist=8 ./script.rpm.sh

Once the repository has been created, you should get the following output:

Generating yum cache for gitlab_gitlab-ce...
Importing GPG key 0x51312F3F:
 Userid     : "GitLab B.V. (package repository signing key) <[email protected]>"
 Fingerprint: F640 3F65 44A3 8863 DAA0 B6E0 3F01 618A 5131 2F3F
 From       : https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey
Importing GPG key 0xF27EAB47:
 Userid     : "GitLab, Inc. <[email protected]>"
 Fingerprint: DBEF 8977 4DDB 9EB3 7D9F C3A0 3CFC F9BA F27E AB47
 From       : https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey/gitlab-gitlab-ce-3D645A26AB9FBD22.pub.gpg
Generating yum cache for gitlab_gitlab-ce-source...

The repository is setup! You can now install packages.

You can check the repository using the following command:

dnf repolist

You should get the following output:

repo id                                               repo name
appstream                                             Rocky Linux 8 - AppStream
baseos                                                Rocky Linux 8 - BaseOS
epel                                                  Extra Packages for Enterprise Linux 8 - x86_64
epel-modular                                          Extra Packages for Enterprise Linux Modular 8 - x86_64
extras                                                Rocky Linux 8 - Extras
gitlab_gitlab-ce                                      gitlab_gitlab-ce
gitlab_gitlab-ce-source                               gitlab_gitlab-ce-source
remi-modular                                          Remi's Modular repository for Enterprise Linux 8 - x86_64
remi-safe                                             Safe Remi's RPM repository for Enterprise Linux 8 - x86_64

Step 4 – Install GitLab CE

Now, install GitLab CE using the following command:

dnf install gitlab-ce -y

Once GitLab has been installed, you should get the following 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 5 – Configure GitLab CE

At this point, GitLab is installed in your system but it is not configured yet. You can configure it by editing /etc/gitlab/gitlab.rb file:

nano /etc/gitlab/gitlab.rb

Define your external URL, email address and enable Let’s Encrypt as shown below:

external_url "https://gitlab.linuxbuz.com"

# Enable the Let's encrypt SSL
letsencrypt['enable'] = true

# This is optional to get SSL related alerts
letsencrypt['contact_emails'] = ['[email protected]']

# This example renews every 7th day at 12:30
letsencrypt['auto_renew_hour'] = "12"
letsencrypt['auto_renew_minute'] = "30"
letsencrypt['auto_renew_day_of_month'] = "*/7"

Save and close the file then run the following command to configure GitLab.

gitlab-ctl reconfigure

Once the configuration has been completed, you should get the following output:

Notes:
Default admin account has been configured with following details:
Username: root
Password: You didn't opt-in to print initial root password to STDOUT.
Password stored to /etc/gitlab/initial_root_password. This file will be cleaned up in first reconfigure run after 24 hours.

The above command will configure GitLab and store the access credential in /etc/gitlab/initial_root_password file.

You can check the access password using the following command:

cat /etc/gitlab/initial_root_password

You should get the following output:

Password: M5wKH1kbSyHQgbr3GqpD4oH7rqv4l/A5f98g/FVq7xA=

Step 6 – Access GitLab CE

You can now access the GitLab CE web UI using the URL https://gitlab.linuxbuz.com. You will be redirected to the GitLab login page:
GitLab Login page
Provide your root username, password and click on the Sign-in button. You should see the GitLab dashboard on the following page:
GitLab Dashboard page

Step 7 – Backup GitLab

It is recommended to back up your GitLab instance per month. You can back up the GitLab instance using the following command:

gitlab-rake gitlab:backup:create

It is also a good idea to make your backups automatic. You can do it by creating a cron job.

nano /etc/crontab

Add the following line:

0   22  *  *  *   gitlab-rake gitlab:backup:create

Save and close the file when you are finished.

Conclusion

In this guide, we explained how to install GitLab CE on Rocky Linux 8. You can now implement GitLab in your local development to track your all projects. Get started on dedicated hosting from Atlantic.Net.

Get A Free To Use Cloud VPS

Free Tier Includes:
G3.2GB Cloud VPS Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year


Looking for a Hosting Solution?

We Provide Cloud, Dedicated, & Colocation.

  • Seven Global Data Center Locations.
  • Flexible Private, Public, & Hybrid Hosting.
  • 24x7x365 Security, Support, & Monitoring.
Contact Us Now! Med Tech Award FTC
SOC Audit HIPAA Audit HITECH Audit

Recent Posts

How to Install Python 3.10 on Rocky Linux 8
How to Install TaskBoard on Rocky Linux 8
How to Set Up Pritunl VPN Server on Rocky Linux 8
How to Install Teampass Password Manager on Rocky Linux 8
How to Install and Configure RabbitMQ Server on Rocky Linux 8

Get started with 12 months of free cloud VPS hosting

Free Tier includes:
G3.2GB Cloud VPS Server Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year


New York, NY

100 Delawanna Ave, Suite 1

Clifton, NJ 07014

United States

San Francisco, CA

2820 Northwestern Pkwy,

Santa Clara, CA 95051

United States

Dallas, TX

2323 Bryan Street,

Dallas, Texas 75201

United States

Ashburn, VA

1807 Michael Faraday Ct,

Reston, VA 20190

United States

Orlando, FL

440 W Kennedy Blvd, Suite 3

Orlando, FL 32810

United States

Toronto, Canada

20 Pullman Ct, Scarborough,

Ontario M1X 1E4

Canada

London, UK

14 Liverpool Road, Slough,

Berkshire SL1 4QZ

United Kingdom

Resources