YouTube Icon

Code Playground.

How to Install and Configure GitLab on CentOS


How to Install and Configure GitLab on CentOS

GitLab is an online open-source Git store supervisor written in Ruby including wiki, issue the board, code audit, checking, and nonstop reconciliation and sending. It empowers designers to fabricate, send and run their applications. 

There are three distinct releases of GitLab accessible, Community Edition (CE), Enterprise Edition (EE), and a GitLab-facilitated form. 

On the off chance that you need to move your undertakings from GitHub, at that point, you should attempt GitLab. It can import ventures and issues from various sources including GitHub, which makes the movement cycle bother free. The GitLab interface is very much planned, spotless, natural and near GitHub's regarding client experience and usefulness. 

There are a few different ways to introduce GitLab relying upon your necessities and inclination. This instructional exercise covers the means fundamental for introducing and designing GitLab (CE) on a CentOS 7 framework utilizing the Omnibus bundles. 


This instructional exercise expects that you have a new CentOS 7 establishment. 

As indicated by the GitLab prerequisites page , it is prescribed to utilize a worker with: 

at any rate 4GB of RAM memory . 

2 CPU centers. 

at any rate 2GB of trade space . 

(discretionary) Domain or subdomain highlighting the worker IP address. 

For an extra layer of security, it is prescribed to set up a fundamental firewall . 

The client you are signing in as must have sudo advantages to have the option to introduce bundles. 

Installing Required Dependencies

Revive the neighborhood bundle record and introduce the conditions with the accompanying orders: 

sudo yum install curl policycoreutils-python openssh-server


With the goal for GitLab to have the option to send warning messages, you can either introduce and utilize Postfix or utilize some conditional mail administration, for example, SendGrid, MailChimp, MailGun or SES in which case you can skirt this after advance and design [GitLab's SMTP settings] ( after the establishment is finished. 

Run the accompanying orders to introduce Postfix on your CentOS worker: 

sudo yum install postfix

During the establishment, you will be approached to choose the mail worker design type. The default alternative is Internet Site. That is the suggested alternative simply press TAB, at that point ENTER. 

Next, you'll be provoked to enter the System mail name which should be same as your worker hostname . 

When the establishment is finished, start and empower the postfix administration by running the accompanying orders: 

sudo systemctl start postfix
sudo systemctl enable postfix

Installing GitLab

GitLab establishment is a pretty straight forward cycle. We will introduce the GitLab CE bundle utilizing the yum bundle supervisor. 

Start by adding the GitLab storehouse to your framework sources list utilizing the accompanying twist order : 

curl | sudo bash

The content will empower the archive and introduce important conditions. When complete, introduce the GitLab bundle by running the accompanying order: 

sudo yum install gitlab-ce

You will be provoked to acknowledge the GitLab archive GPG keys. Type y and press Enter. 

The establishment cycle may take some time and after a fruitful establishment, you will see the accompanying yield: 

Thank you for installing GitLab!

Adjusting the Firewall Rules

The guide about setting up a fundamental firewall is connected in the requirements area. To have the option to get to the GitLab interface you'll have to open ports 80 and 443. To do so run the accompanying orders: 

sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --permanent --zone=public --add-service=https
sudo firewall-cmd --reload

Set the GitLab URL

Prior to getting to the GitLab web interface we need to set the URL on which GitLab will be reachable. Open Gitlab's design document and roll out the accompanying improvements: 

sudo vim /etc/gitlab/gitlab.rb

Close to the highest point of the design document, you will see a line beginning with external_url. Change the incentive to coordinate your space/subdomain or IP address. On the off chance that you have space use https and in the event that you need to get to the GitLab interface through you worker IP address use http. 


external_url ''

Next quest for "How about we Encrypt mix", uncomment the line beginning with letsencrypt['enable'] and set it to valid. Alternatively in the event that you need to get messages from Let's Encrypt concerning your space uncomment the line beginning with letsencrypt['contact_emails'] and add your email address. 

On the off chance that you set the external_url to an IP address, at that point you ought not empower Let's Encrypt reconciliation. 


letsencrypt['enable'] = true
letsencrypt['contact_emails'] = [''] # This should be an array of email addresses to add as contacts

At last spare and close the document and run the accompanying order to reconfigure Gitlab: 

sudo gitlab-ctl reconfigure

The order will reconfigure the GitLab settings and create a free Let's encode SSL authentication. 

Configure GitLab through the Web Interface

Since you have arranged the GitLab URL you can begin with the underlying setup through the GitLab web interface. 

Dispatch your internet browser and explore to:

1. Setting administrative account password

The first occasion when you access the web interface you'll be incited to set the secret key for the managerial record. 

Enter a protected secret word and snap on the Change your secret key catch when you are done. 

You will be diverted to the login page: 

The default regulatory record username is root. Later in this instructional exercise, we will tell you the best way to change the username. 

  • Username: root 
  • Secret word: [the secret word you have set] 

Enter the login certifications, click the Sign in catch and you will be diverted to the GitLab Welcome page. 

2. Editing User profile

The primary thing you will need to do is to alter your client profile. Snap on the client symbol (upper-right corner) and starting from the drop menu, select Settings: 

Here you can change your Name, Email, and other profile data and settings. Roll out the improvements as per your preferring. 

Whenever you are done tap on the Update Profile settings button and in the blink of an eye you will get an affirmation email to the location you gave. To affirm your record adhere to the guidelines gave in the email. 

3. Changing Username

To get to the Profile page, click on the Account connect from the left-hand vertical route menu. 

As you definitely know the default username of the principal regulatory record is root. To transform it simply type your new username and snap on the Update username button. 

On this screen, you can likewise empower two-factor verification. 

Whenever you sign in to your GitLab dashboard you should enter the new username. 

4. Adding SSH Key 

To have the option to push your neighborhood git changes to the GitLab worker you to add your SSH public key to your GitLab account. 

In the event that you as of now have a SSH key pair made on your nearby framework you can show the public key by composing: 

cat ~/.ssh/

The yield should look something like the accompanying: 

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDd/mnMzHwjUzK8g3ldfsfRpJuC16mhWamaXRk8ySQrD/dzpbRLfDnZsLxCzRoq+ZzFHGwcQlJergtergdHGRrO8FE5jl3IWRRp+mP12qYw==

On the off chance that the order above prints No such document or registry it implies that you don't have a SSH key pair created on your machine. 

To create another SSH key pair utilize the accompanying order: 

ssh-keygen -t rsa -b 4096 -C ""

Duplicate the yield from the feline order and return to the GitLab's web interface. Snap SSH Keys from the left-hand vertical route menu to get to the SSH Keys arrangement page. 

In the Key textarea glue the public key you recently replicated from your nearby machine, set a clear title and snap on the Add key catch: 

GitLab add SSH Key 

Presently you should have the option to push and pull your venture changes from your neighborhood PC without giving your GitLab account certifications. 


This instructional exercise strolled you through the establishment and arrangement of GitLab on CentOS 7. You additionally figured out how to alter your profile settings, how to change the username and add a SSH key. You would now be able to make your first task and begin utilizing your GitLab. 

In the event that you have questions, don't hesitate to leave a remark beneath.