How To Install and Configure GitLab on CentOS 8 / RHEL 8

0
394

Introduction:

GitLab is a powerful Open source platform based on git for accelerated software development & collaboration. GitLab provides various scratch features like Auto DevOps, Kubernetes integration, GitLab Container Registry etc. There are two distinct editions available for GitLab.

  • GitLab Community Edition (CE) -Available for public
  • GiLab Enterprise Edition (EE) -For Enterprises with greater features.

In this article you will cover the Installation of GitLab on CentOS 8 / RHEL 8. Just follow the below steps to get started.

Step 1: Update your system

Make sure your system is updated or update it by

sudo yum -y update

Step 2: Install Dependencies

Run the given command to install the Dependencies on your CentOS 8 system.

sudo yum -y install curl vim policycoreutils python3-policycoreutils

You can Install Postfix to send mail notifications by

sudo yum -y install postfix

Now, after installation start and enable Postfix services.

sudo systemctl enable postfix
sudo systemctl start postfix

To configure external email relay service after setting up Gitlab check the below:

How To configure an external SMTP Server.

Step 3: Adding the GitLab CE Repository

Add the GitLab Repository for CentOS 8 / RHEL 8

sudo vi /etc/yum.repos.d/gitlab-ce.repo

After it paste the below data into the above file.

[gitlab-ce]
name=gitlab-ce
baseurl=https://packages.gitlab.com/gitlab/gitlab-ce/el/7/$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
metadata_expire=300

Now, save the file & update your RPM packages.

sudo yum makecache

Step 4: Installing GitLab CE on CentOS 8 / RHEL 8

Run the given command to Install GitLab CE

EXTERNAL_URL="http://git.example.com" yum install -y gitlab-ce

Step 5: Configuring GitLab CE

After successful installation, move toward configuring GitLab CE that works for our environment. You can find the main configuration file under /etc/gitlab/gitlab.rb

sudo vi /etc/gitlab/gitlab.rb

Now, set up your URL on which GitLab will be reachable:

external_url 'http://gitlab.example.com'

Save & and run the reconfiguration script

sudo gitlab-ctl reconfigure

You will see a similar output upon successful reconfiguration

Step 6: Allow Firewall

Type the given command to allow firewall access as http, https, and ssh services & reload it.

sudo firewall-cmd --permanent --add-service={ssh,http,https} --permanent 
sudo firewall-cmd --reload

Step 7: Accessing Gitlab Web Console

Finish the GitLab installation by visiting http://gitlab.example.com.

Provide password details for root and click “Change Your Password

After it you can provide these details to access GitLab Administration dashboard.

Step 8: Disable User Sign Up

Login as a root user

Go to Settings page at the bottom left navigation pane and expand the Sign-up restrictions section to disable sign up for new users.

Unchecked the sing-up enabled & save changes

Logout to confirm the changes. Note the changes.

Step 9: Secure GitLab with SSL (Recommended)

As you all know SSL provides you a high security to stay away from spammers. I recommend to Install SSL on your GitLab server. Follow the below link if you don’t know to Install SSL.

How To Secure GitLab server with SSL certificate

Step 10: Enable LDAP authentication (Optional)

To use LDAP as a primary authentication method, configure GitLab to use an LDAP server such as FreeIPA to authenticate users.

How To Configure FreeIPA LDAP Authentication

LEAVE A REPLY

Please enter your comment!
Please enter your name here