(Last Updated On: December 12, 2018)

In this guide, we will cover the installation of Gitlab on CentOS 7 / Fedora 29 / Fedora 28. Gitlab is Git-based fully featured platform for accelerated software development. It provides up to scratch features like integrated CI/CD, Auto DevOps, Kubernetes integration, GitLab Container Registry e.t.c.

Since this installation is for Gitlab Community Edition, more features can be unlocked by moving to subscription. check the GitLab subscriptions for details.

Install Gitlab on CentOS 7 / Fedora 29 / Fedora 28

The start of the actual installation of Gitlab on CentOS 7 / Fedora 29 / Fedora 28 is this section. Gitlab installation requires your server to have a minimum of 4GB ram and 2 CPU cores.

If you do an installation on a system with lower hardware specifications, you may experience tortoise-like performance.

Step 1: Install necessary dependencies

Install Dependencies on CentOS 7

sudo yum -y update
sudo yum -y install epel-release curl vim policycoreutils-python

For Fedora 29 / Fedora 28

sudo dnf -y install curl vim policycoreutils-python

If you want to install and use local Postfix server for sending notifications, then install Postfix:

sudo yum install postfix
sudo dnf install postfix

Start and enable Postfix service after the installation.

sudo systemctl enable postfix
sudo systemctl start postfix

For configuration of external email relay service after setting up Gitlab, check configure an external SMTP server .

Step 2: Add the Gitlab CE Repository

GitLab provides omnibus packages from a repository. These packages are compiled specifically for CentOS but can be installed on a Fedora system.

Create a new repository file for Gitlab:

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

Then add the following lines:

[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

Save the file and update your RPM packages index.

sudo yum makecache fast  # CentOS 7
sudo dnf makecache       # Fedora

Step 3: Install Gitlab CE on CentOS 7 / Fedora 29 / Fedora 28

Install Gitlab CE by running the command:

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

Replace EXTERNAL_URL with your domain name for Gitlab.

Step 4: Configure Gitlab CE on CentOS 7 / Fedora 29 / Fedora 28

You need to set URL on which GitLab will be reachable from outside. This is done by editing Gitlab configuration file /etc/gitlab/gitlab.rb

sudo vim /etc/gitlab/gitlab.rb

URL can be set on:

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

There are many other GitLab CE Configuration Settings that you can set to fit your preference. Once done, save the file and run Gitlab reconfiguration script.

sudo gitlab-ctl reconfigure

This will start a Chef local execution to configure Gitlab. When it finishes, you should get a success message.

................
Running handlers:
Running handlers complete
Chef Client finished, 438/620 resources updated in 04 minutes 44 seconds
gitlab Reconfigured!

If you have an active firewall, allow http, https and ssh services.

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

Open your browser and go to URL http://gitlab.example.com to finish the installation of Gitlab.

You’re asked to create a new password for your account. Set a new password for root user then click “Change your password“.

Login with the username root and password set above

You should be directed to the Gitlab administration dashboard. You can update your user profiles and add other Gitlab users & groups.

Secure Gitlab CE with SSL Certificate

Read our next article below on how to configure your GitLab server to be accessible via HTTPS

How To Secure GitLab Server with SSL Certificate

Visit Gitlab Documentation page for more learning on Gitlab administration.

If you need LDAP Authentication on your GitLab Server, read:

How to Configure GitLab FreeIPA Authentication

Related articles:

How to Install the latest version of Git ( Git 2.x ) on CentOS 7

How to Install Gitea self-hosted Git service on CentOS 7 with Nginx Reverse Proxy

How to Install Gitea self-hosted Git service on Ubuntu 18.04 / Ubuntu 16.04

How to Install Gogs self-hosted Git service on Ubuntu 18.04 / Ubuntu 16.04