How to Install Gitlab on CentOS 7

Install Gitlab on CentOS 7

In this tutorial we’ll learn how to install Gitlab on CentOS 7. We will also install and configure its prerequisites. Gitlab is a popular git repository hosting application. You can use it to store versioned copies of code and collaborate with others. It provides a web interface that allows you to view syntax-highlighted code, compare diffs, handle merge requests, etc. It is comparable in many ways to Github, except that you can host Gitlab on your own server.

I recommend to use a minimal Ubuntu server setup as a basis for the tutorial, that can be a virtual or a root server image with an CentOS 7 minimal install from a web hosting company or you use our minimal server tutorial to install a server from scratch.

Install Gitlab on CentOS 7

Step 1. First, ensure your system is fully up-to-date by running the following:

yum -y update

Step 2. Installing the necessary dependencies.

You’all need to install some basic prerequisite packages for Gitlab:

yum install postfix openssh-server -y

Execute the systemctl enable command for both Postfix and the OpenSSH server:

systemctl start sshd
systemctl start postfix

If you are using iptables (a software firewall) you will need to open port 80 or port 443 if you are going to be installing an SSL certificate:

firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-service=https
systemctl reload firewalld

Step 3. Installing Gitlab.

Now execute the following command to add Gitlab package server into your repository:

curl -sS | sudo bash

When you have downloaded the package you want, complete the repository installation by executing:


Now run the following command to install Gitlab:

yum install gitlab-ce

Once the installation is finished you will see output similar to this:

gitlab: Thank you for installing GitLab!
gitlab: To configure and start GitLab, RUN THE FOLLOWING COMMAND:
sudo gitlab-ctl reconfigure
gitlab: GitLab should be reachable at..

Now you will need to run the following command to configure and run GitLab:

gitlab-ctl reconfigure

Step 6. Accessing Gitlab Web Installation.

Now you can access the Gitlab web install wizard in your browser by entering the domain name or http://your_ip/ to continue your  installation.

Congratulation’s! You have successfully install and configured Gitlab on your CentOS 7 server.