Latest

Thursday, 9 July 2020

How to install GitLab CE on CentOS/Rocky Linux 8

Install GitLab CE on CentOS 8

In this lab, you will learn how to install GitLab CE (Community Edition) on CentOS/Rocky Linux 8.

 

Table of Contents:

 

What is GitLab? :

GitLab is web-based software for managing complete DevOps life cycle. GitLab provides a Git repository manager providing wiki, issue-tracking and continuous integration/continuous deployment (CI/CD) pipeline features.

GitLab is developed by GitLab Inc and available in following two editions.

  • GitLab CE - Community Edition : It is open core edition of GitLab available under MIT License.
  •  

  • GitLab EE - Enterprise Edition: It is commercial edition of GitLab. Enterprise Edition is loaded with many advanced features as compare to Community Edition, but you need to acquire a proprietary license to unlock these features. Although, you can use GitLab EE without a license but it will allow you only those features that are available in Community Edition.

GitLab was initially written in Ruby, but later on some parts were rewritten in Go language. The current technology stack include Go, Ruby on Rails and Vue.js.

Install GitLab CE on CentOS 8

Environment Specification:

We are using a minimal installed CentOS 8 virtual machine with following specification.

  • CPU - 3.4 Ghz (2 cores)
  • Memory - 2 GB
  • Storage - 40 GB
  • Operating System - CentOS 8.2
  • Hostname – gitlab-ce-01.centlinux.com
  • IP Address - 192.168.116.206 /24

 

Update CentOS 8 Software Packages:

Connect with gitlab-ce-01.centlinux.com as root user by using PuTTY.

Update installed software packages by using dnf command.

# dnf update -y

Verify the Linux Kernel version.

# uname -a
Linux gitlab-ce-01.centlinux.com 4.18.0-193.6.3.el8_2.x86_64 #1 SMP Wed Jun 10 11:09:32 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

Verify the version of Linux operating system.

# cat /etc/redhat-release
CentOS Linux release 8.2.2004 (Core)

 

Installing GitLab CE Prerequisites:

GitLab CE requires some other software packages. Therefore, we are installing them by using the dnf command.

# dnf install -y curl policycoreutils openssh-server

All three packages are already installed on our Linux server.

DevOps software also requires a local SMTP server to send emails notifications. Therefore, we are installing Postfix on our Linux server.

# dnf install -y postfix

Start and enable Postfix service.

# systemctl enable --now postfix.service
Created symlink /etc/systemd/system/multi-user.target.wants/postfix.service รข /usr/lib/systemd/system/postfix.service.

 

Configure Linux Firewall:

GitLab web application runs by default on port 80 and 443. Therefore, we are allowing the http and https services in Linux firewall.

# firewall-cmd --permanent --add-service={http,https}
success
# firewall-cmd --reload
success

 

Installing GitLab Yum Repository:

GitLab documentation provides a script to to install their official yum repository. We are executing that same command here.

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

 

Installing GitLab CE on CentOS 8:

Since, we have successfully installed GitLab yum repository on our CentOS 8 machine. Now, we can easily install our DevOps Server by using dnf command.

# dnf install -y gitlab-ce

GitLab CE installation has been successful.

 

GitLab CE Server Configuration:

GitLab server configuration files are located in /etc/gitlab directory.

Open gitlab.rb configuration file in a text editor.

# vi /etc/gitlab/gitlab.rb

Locate and set external_url directive as follows.

external_url 'http://gitlab-ce-01.centlinux.com'

Invoke the GitLab server configuration process by using the following command. You should keep patience, because it will take a while to complete. On machine that was used in this tutorial, it took about 44 minutes to complete.

# gitlab-ctl reconfigure
Starting Chef Client, version 14.14.29
resolving cookbooks for run list: ["gitlab"]
Synchronizing Cookbooks:
  - gitlab (0.0.1)
  - redis (0.1.0)
  - mattermost (0.1.0)
  - gitaly (0.1.0)
  - praefect (0.1.0)
  - letsencrypt (0.1.0)
  - package (0.1.0)
  - postgresql (0.1.0)
  - consul (0.1.0)
  - registry (0.1.0)
  - monitoring (0.1.0)
  - runit (5.1.3)
  - nginx (0.1.0)
  - crond (0.1.0)
  - acme (4.1.1)
Installing Cookbook Gems:
Compiling Cookbooks...
...
...
...
Running handlers:
Running handlers complete
Chef Client finished, 562/1517 resources updated in 44 minutes 21 seconds
gitlab Reconfigured!

 

Accessing GitLab CE Web Interface:

GitLab CE is web-based, therefore, we only requires a supported web browser to access the application.

Open URL http://gitlab-ce-01.centlinux.com in a web browser.

01-install-gitlab-ce-on-centos-8-change-password

Since, we are accessing GitLab web interface for the first time, therefore, we have been asked by the  application to set a strong administrator password.

Default administrative user is root.

Set a strong password for the root user.

02-install-gitlab-ce-on-centos-8-sign-in

Now, sign-in to web application as root user.

03-install-gitlab-ce-on-centos-8-projects

We have reached the main screen of the web application.

Click on "Configure GitLab".

04-install-gitlab-ce-on-centos-8-dashboard

We have been redirected to the Dashboard of the GitLab web interface. You can confirm the versions of GitLab components that have been installed on our Linux server.

 

Conclusion:

We have successfully installed GitLab CE on CentOS/Rocky Linux server. If you want to start your career in DevOps and more specifically with GitLab, we strongly recommend that you should buy Mastering GitLab 12: Implement DevOps culture and repository management solutions by Joost Evertse. Or enrolled in GitLab CI: Pipelines, CI/CD and DevOps for Beginners training by Udemy at a very reasonable price.

If you find this article useful? Don't you mind support us by Buy Me A Coffee


8 comments:

  1. Hello, I have followed the instruction exactly as stated, but the interface is not working.

    I am using Centos8 with VirtualBox 6.1., and have gone into vi /etc/gitlab/gitlab.rb as suggested and

    changed to " external_url 'http://gitlab-ce-01.centlinux.com'". However, i am getting this error

    message: "Hmm. We’re having trouble finding that site". I am new to Linux and would appreciate any

    help in resolving this issue. Thanks very much, David

    ReplyDelete
    Replies
    1. Hi,
      Please ensure that the hostname "gitlab-ce-01.centlinux.com" is resolvable. Check this by using ping command. And if it is not resolvable then add it to Local DNS Resolver.

      Delete
  2. Thanks very much for getting back to me, Ahmer! Gitlab-ce-01.centlinux.com is not pingable, and I am new to Linux/centos8 (learning on my own) and would appreciate any help you could offer, or specific instructions on how to add it to the Local DNS Resolver, PLEASE. I saw some info on Google but not sure if it's the right info to resolve this issue. Thanks, David

    ReplyDelete
    Replies
    1. Hi,
      A simple solution is that, replace the hostname with IP address of the Linux server in the following directive.

      external_url '192.168.116.206'

      Delete
  3. Hi Ahmer, I am not sure if you got the message i sent yesterday, but the ip address above is giving me the same error message.

    ReplyDelete
  4. I am removing the ## from the external_url (##!external_url to '192.168.116.206') to make it active, right?

    Thanks, D

    ReplyDelete
    Replies
    1. Please discuss it with me in detail at our Facebook Page.

      Delete

© 2022 CentLinux. All Rights Reserved.