Hamsa K
4 min read | 3 years ago

How to Install and Configure GitLab on Centos 7

Install and configure Gitlab on centos 7

GitLab is a web-based open source Git repository manager.It enables developers to build, deploy and run their applications.Gitlab is available in four diffrent versions.

  1. Gitlab CE (Community Edition) - self-hosted and free; It support from the Community forum.
  2. Gitlab EE (Enterprise Edition) - self-hosted and paid; Its having few additional features.
  3. GitLab.com - SaaS and free.
  4. GitLab.io - Private GitLab instance managed by GitLab Inc.

In this Article, we will install and configure GitLab (Community Edition) on CentOS 7 Server. 

Ram size: Min 2 to 4GB or above.

Step 1: Install Required dependency packages

First we will install few dependency packages related to Gitlab installation.

[root@localhost ~]# yum install curl policycoreutils openssh-server openssh-clients

and also need to install postfix service to send email notifications

[root@localhost ~]# yum install postfix
[root@localhost ~]# systemctl start postfix
[root@localhost ~]# systemctl enable postfix

Step 2: Install Gitlab

we will add Gitlab repository to our system and download the installer with curl and need to run the script as shown below.

[root@localhost ~]# curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash

GitLab CE repository has been added to system.Next install gitlab using yum

[root@localhost ~]# yum install gitlab-ce

sample output:

       *.                  *.
      ***                 ***
     *****               *****
    .******             *******
    ********            ********
     _______ __  __          __
    / ____(_) /_/ /   ____ _/ /_
   / / __/ / __/ /   / __ `/ __ \
  / /_/ / / /_/ /___/ /_/ / /_/ /
Thank you for installing GitLab!
you can start your GitLab instance by running the following command:
sudo gitlab-ctl reconfigure

Step3 : configure gitlab url

now goto gitlab default configuration directory and edit gitlab.rb with your favourite editor with the following command.

vi /etc/gitlab/gitlab.rb

Replace external_url line with your domain name 

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

save the file and exit.

Now reconfigure gitlab to apply changes in the configuration file.

gitlab-ctl reconfigure

If firewall is running on your system,then need to open port 80 and 443 to allow connections.

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

Step 4: Gitlab webinterface

Now you can start with the initial configuration through GitLab web interface.

http://your_domain or ip_address

when first time you access the web interface then you’ll be prompted to set the password for the administrative account.Change the root password with your own password, and click on 'change your password' button to confirm.


Warning! This site uses cookies
By continuing to browse the site, you are agreeing to our use of cookies. Read our terms and privacy policy