How to Install and Configure GitLab on CentOS 7

Gitlab is an open source, powerful, robust, scalable, secure, as well as efficient software development and collaboration platform for all stages of the DevOps lifecycle.

It allows you to plan your development process; code, and verify; package software, and release it with an in-built continuous delivery feature; automate configurations management, and monitor software performance.

It has features such as an issue tracker, moving of issues between projects, time tracking, very powerful branching tools, file locking, merge requests, custom notifications, project roadmaps, burndown charts for project and group milestones, and so much more.

Gitlab is one of the best alternatives to Github for hosting your open source projects, that you will find out there.

In this article, we will explain how to install and configure Gitlab (Git-repository manager) on CentOS 7 or RHEL 7 Linux distributions.

Step 1: Install and Configure Required Dependencies

1. First start by installing following necessary dependencies using yum package manager as shown.

# yum install curl policycoreutils-python openssh-server 

2. Next, install Postfix service to send notification emails, and enable it to start at system boot, then check if its up and running using following commands.

# yum install postfix
# systemctl start postfix
# systemctl enable postfix
# systemctl status postfix

During Postfix installation a configuration window may appear. Select ‘Internet Site‘ and use your server’s external DNS for ‘mail name‘ and press enter. If extra screens appear, continue to press enter to accept the defaults.

Step 2: Add GitLab Repository and Install Package

3. Now add the GitLab package YUM repository to your system by running a following script.

$ curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash

4. Next, install the GitLab Community Edition package using following command and make sure to change ‘http://gitlab.tecmint.com‘ to the URL at which you want to access your GitLab instance from a web browser.

# EXTERNAL_URL="http://gitlab.tecmint.com" yum install -y gitlab-ce

Note: If you want to change your main URL, you can configure it in the GitLab main configuration file /etc/gitlab/gitlab.rb in the external_url section. Once changed, don’t forget to reconfigure gitlab to apply the recent changes in the configuration file using following command.

# gitlab-ctl reconfigure

5. If you have a system firewall enabled, you need to open port 80 (HTTP) and 443 (HTTPS) to allow connections in the system firewall.

# firewall-cmd --permanent --add-service=80/tcp
# firewall-cmd --permanent --add-service=443/tcp
# systemctl reload firewalld

Step 3: Perform Initial Gitlab Setup

6. Now, open a web browser and access your gitlab instance using the following URL you set during installation.

http://gitlab.tecmint.com

7. On your first visit, you’ll be redirected to a password reset screen, create a new password for your new admin account and click “Change your password”. Once you set, it will be redirected back to the login screen and login with username root and the password you set.

GitLab Admin Login

GitLab Admin Login

8. A successful login should take you into the admin user account as shown in the screenshot. From, here, you can create an object, create a group, add people or configure your gitlab instance as you wish. You can also edit your user profile, configure your email, and add SSH keys to your gitlab instance, and more.

Gitlab Admin Control Panel

Gitlab Admin Control Panel

For more information, go to Gitlab About Page: https://about.gitlab.com/

That’s all for now! In this article, we have explained how to install and configure a Gitlab (Git-repository manager) on CentOS 7 or RHEL 7 Linux distributions.. If you have any questions or thoughts to add to this guide, use the comment form below to reach us.

Best Affordable Linux and WordPress Services For Your Business
Outsource Your Linux and WordPress Project and Get it Promptly Completed Remotely and Delivered Online.

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Get your own self-hosted blog with a Free Domain at ($3.45/month).
  4. Become a Supporter - Make a contribution via PayPal
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

Aaron Kili

Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

11 Responses

  1. Jaime says:

    In my case, Apache is using port 80 and port 443. Where are gitlab pages stored so that I can point Apache to there?

  2. Saurabh says:

    Can we integrate LDAP with Gitlab for Auth process?

  3. Parag Borle says:

    Can we configure gitlab high availability using DRBD ?

  4. Daniel says:
    # firewall-cmd --permanent --add-service=http
    # firewall-cmd --permanent --add-service=https
    or
    # firewall-cmd --permanent --add-port=80/tcp
    # firewall-cmd --permanent --add-port=443/tcp
    
  5. zainul says:

    Please share the guide on how to configure email setup (postfix) for gitlab ce on centos7.

  6. shai says:

    Thanks alot.

    Here should be yum install -y gitlab-ce and not ee.

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.