Atlantic.Net Blog

How to Install GitLab CE on Oracle Linux 8

GitLab is a free, open-source, web-based DevOps software solution that combines the ability to develop, secure, and operate software in a single application. It is written in Ruby and used by thousands of organizations worldwide. GitLab is a Git repository manager that offers a lot of features including issue tracking, continuous integration, deployment pipeline, and more. It comes in two editions, the Enterprise Edition and the Community Edition. It is very similar to GitHub and allows you to integrate it with various services. You can host your own repository using GitLab in a development environment that allows developers to host their projects.

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

Step 1 – Install Postfix Server

Before starting, you will need to install the Postfix package to include mail functionality. You can install it using the following command:

dnf install postfix

After the installation, start the Postfix service and enable it to start at system reboot:

systemctl enable --now postfix

Also Read

How to Install and Secure PostgreSQL Server

Step 2 – Add GitLab CE Repository

By default, the GitLab package is not included in the Oracle 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 wget command:

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

Once the script is downloaded, set execution permissions using 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:

Complete!
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 now check the repository using the following command:

dnf repolist

You should see the GitLab repository in the following output:

repo id                                       repo name
gitlab_gitlab-ce                              gitlab_gitlab-ce
gitlab_gitlab-ce-source                       gitlab_gitlab-ce-source
ol8_UEKR6                                     Latest Unbreakable Enterprise Kernel Release 6 for Oracle Linux 8 (x86_64)
ol8_appstream                                 Oracle Linux 8 Application Stream (x86_64)
ol8_baseos_latest                             Oracle Linux 8 BaseOS Latest (x86_64)
pgdg-common                                   PostgreSQL common RPMs for RHEL / Oracle 8 - x86_64
pgdg10                                        PostgreSQL 10 for RHEL / Oracle 8 - x86_64
pgdg11                                        PostgreSQL 11 for RHEL / Oracle 8 - x86_64
pgdg12                                        PostgreSQL 12 for RHEL / Oracle 8 - x86_64
pgdg13                                        PostgreSQL 13 for RHEL / Oracle 8 - x86_64
pgdg14                                        PostgreSQL 14 for RHEL / Oracle 8 - x86_64

Step 3 – Install GitLab CE on Oracle Linux 8

At this point, the GitLab CE repo is added to the server. You can 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

For a comprehensive list of configuration options please see the Omnibus GitLab readme
https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md
  

Step 4 – Configure GitLab CE

GitLab is now installed on 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 UR and 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:

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.

NOTE: Because these credentials might be present in your log files in plain text, it is highly recommended to reset the password following https://docs.gitlab.com/ee/security/reset_user_password.html#reset-your-root-password.

gitlab Reconfigured!

The above command will configure GitLab and store the access credentials in the /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: Uzpeo6P8eYZQE5D0hMtCAC2xH9rCjTsx1E9iYvGQMuw=

Step 5 – Access GitLab CE Dashboard

Now, open your web browser and 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 and password and click on the Sign in button. You should see the GitLab dashboard on the following page:
GitLab dashboard page

Step 6 – Backup GitLab

It is a good idea to back up your GitLab instance regularly. To back up the GitLab instance, run 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 learned how to install GitLab CE on Oracle Linux 8. We also learned how to edit the GitLab CE and enable the Let’s Encrypt SSL. Your GitLab instance is now installed and secured. You can now start using GitLab in a local development environment to track all projects. Get started on VPS hosting from Atlantic.Net.

Get a $250 Credit and Access to Our Free Tier!

Free Tier includes:
G3.2GB Cloud VPS a 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