21st June, 2016 | Tutorials |

How to Install and Setup GitLab on CentOS 7

Want your very own server? Get our 1GB memory, Xeon V4, 25GB SSD VPS for £10.00 / month.

Get a Cloud Server

Gitlab is graphical implementation of git, it is an open source repository management and version control system. GitLab is developed on Ruby on Rails. Using GitLab you can host your source code on your own server. This ensures security of the code, and gives you total freedom on the number of users as well as number of repositories and number of files. GitLab provides you with a platform to collaborate on projects and to keep track of changes in code. GitLab is widely used for software development and version control related tasks. In many ways it is similar to GitHub, except you can install it in your own server. It is very popular version control system and used by many prominent companies like Alibaba, IBM, NASA, SpaceX etc.

Features of GitLab

Although there are many features of GitLab, but few notable features are.


GitLab supports many Linux operating system but in this tutorial we are going to install GitLab Community Edition into CentOS 7.x.

Requirements to install GitLab -

Installing GitLab

In this guide we will be using a non root account to install GitLab and all the required dependencies. If you are logged in to your server using rootaccount, omit using sudo command from all the commands.

Update the packages of yum using the following command

sudo yum -y update

Now install SSH server on your machine using the command below. If you are installing it on a remote server using an SSH client like putty then you already have openssh-server and openssh-clients installed. If they are already installed you can skip this step.

sudo yum -y install openssh-server openssh-clients sudo systemctl enable sshd sudo systemctl start sshd

The first command will install SSH on your server, if it is already installed, it will display a message that nothing to do. The next command will enable the SSH server to automatically start on startup. The final command will start SSH immediately.

Now install dependencies by running the following command.

sudo yum -y install curl policycoreutils postfix sudo systemctl enable postfix sudo systemctl start postfix

The first command will install curl, policycoreutils and postfix in to your server. curl is used to transfer data between servers and the policycoreutils packages contain the core utilities that are required for the basic operation of a SELinux system and its policies. postfix is a free and open-source mail transfer agent that routes and delivers emails. The next command will enable postfix to automatically start on startup. The final command will start postfix immediately.

Now add firewall exception for http and https in your server by issuing the following commands -

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

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

curl -sS | sudo bash

Now run the following command to install Gitlab Community Edition -

sudo yum -y 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 gitlab: Otherwise configure GitLab for your system by editing /etc/gitlab/gitlab.rb file gitlab: And running reconfigure again. gitlab: gitlab: For a comprehensive list of configuration options please see the Omnibus GitLab readme gitlab: gitlab: It looks like GitLab has not been configured yet; skipping the upgrade script. Verifying : gitlab-ce-8.8.5-ce.1.el7.x86_64 1/1

Installed: gitlab-ce.x86_64 0:8.8.5-ce.1.el7


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

sudo gitlab-ctl reconfigure

Now you browse the following address using your favorite web browser -


Where server_IP_address is the IP address of your server. You can also access the server using your hostname if your domain is pointed to the server. You will see the following interface in your browser, where you will be asked to create a new password for root or Administrative user of GitLab.

HP_NO_IMG/data/uploads/users/1a4f26de-5d97-48b7-abf5-631194ef3a10/694461511.png" alt="" />

Enter the new password twice and click on Change your password button.

Now you will be taken to sign in interface. This interface will be shown to everybody who visits the website. You can login to administrative account by using the username root and your newly created password.

HP_NO_IMG/data/uploads/users/1a4f26de-5d97-48b7-abf5-631194ef3a10/1876564229.png" alt="" />

Once you are logged in you will see the following interface -

HP_NO_IMG/data/uploads/users/1a4f26de-5d97-48b7-abf5-631194ef3a10/683236370.png" alt="" />

GitLab is now successfully installed. Now you can either configure the settings or you can create a new project.

Branding of the Login Page

Once you are logged in you can brand your login page by changing the logos and text of your login page. Click on the small setting icon next to search bar on top menu to access Admin area of GitLab.

HP_NO_IMG/data/uploads/users/2a78e75d-343a-47ce-9d84-14a6ba54abbc/1250983085.png" alt="" />

Click on the Appearance option from sidebar and you will be taken to Appearance settings interface from where you can modify look and feel of GitLab. For Sign in/Sign up pages, Enter your custom title of the page. In the description area, you can provide a further description for the login page, in Markdown syntax. Next choose your custom logo for the Sign in/Sign up page. The recommended size of the logo is 640x360 px. In next option you can choose Logo for your header. The recommended size for header logo is 72x72 px. Click the Save button to save the Appearance of the pages.

HP_NO_IMG/data/uploads/users/2a78e75d-343a-47ce-9d84-14a6ba54abbc/1853140762.png" alt="" />

Now you can logout to view the login page changes.

HP_NO_IMG/data/uploads/users/2a78e75d-343a-47ce-9d84-14a6ba54abbc/1657903592.png" alt="" />

Creating a New Project

To create a new project on GitLab, go back to the user dashboard by clicking on the GitLab Icon, and then click on New Project button, or you can always click on the + icon next to the notification icon to create a new project.

HP_NO_IMG/data/uploads/users/2a78e75d-343a-47ce-9d84-14a6ba54abbc/1475532413.png" alt="" />

In the new project interface, enter the path for your new project. If you want to import project from some other source, you can click on the icon provided. Now enter the description for your project, and choose a visibility level for your project. If project visibility is set to Private then admin must provide permission to each user to access the project. The project can be cloned by only those users who have access to the project. If project visibility is set to internal then all the logged in user can clone the project, if it is set to public then project can be cloned without any authentication.

HP_NO_IMG/data/uploads/users/2a78e75d-343a-47ce-9d84-14a6ba54abbc/1970635442.png" alt="" />

Click on Create project button and your project will be created.

HP_NO_IMG/data/uploads/users/2a78e75d-343a-47ce-9d84-14a6ba54abbc/839194604.png" alt="" />

To clone, push or pull the project via git, you will need to add your SSH public key. You can click on add an SSH key link, or you can always go to your Profile -> Keys to add SSH keys. In Add an SSH key, enter your public key in Key field and provide a title for your key.

HP_NO_IMG/data/uploads/users/2a78e75d-343a-47ce-9d84-14a6ba54abbc/907598572.png" alt="" />

Click on Add key once done. You can now manage your project via SSH too.


In this tutorial we have learnt how to install and setup Gitlab on CentOS 7.x. You can now successfully deploy GitLab on CentOS. You can also setup a new project in GitLab. Using GitLab is very easy, and it has an inbuilt help feature to provide you instructions on using GitLab. Once you setup GitLab successfully, all your collaborators can signup and start contributing to your project.

Want your very own server? Get our 1GB memory, Xeon V4, 25GB SSD VPS for £10.00 / month.

Get a Cloud Server