Git

How to install GitLab on CentOS 8

Share on Social Media

Learn how to install GitLab on CentOS 8 with this comprehensive step-by-step guide, enabling efficient code management and collaboration for your development team. #centlinux #linux #git

What is GitLab?

GitLab is a web-based DevOps lifecycle tool that provides a Git repository manager along with a comprehensive suite of features for software development and collaboration. It offers a centralized platform where teams can manage code repositories, plan and track project tasks, collaborate on code, and automate software delivery pipelines.

Key features of GitLab include:

  • Git Repository Management: GitLab serves as a Git repository hosting service, allowing teams to store, manage, and version control their codebases.
  • Issue Tracking and Project Management: It includes robust issue tracking capabilities with customizable issue boards, milestones, and labels. Teams can manage tasks, track progress, and coordinate efforts efficiently.
  • CI/CD Pipelines: GitLab provides built-in Continuous Integration (CI) and Continuous Deployment (CD) capabilities. Users can automate testing, building, and deploying applications, streamlining the software delivery process.
  • Code Review: Facilitates code collaboration and review with features like merge requests (pull requests), inline commenting, and approvals, ensuring code quality and team collaboration.
  • Wiki and Documentation: Offers a built-in wiki system for documenting projects and processes, enhancing knowledge sharing within teams.
  • Security and Compliance: Includes security scanning tools to detect vulnerabilities in code and dependencies. GitLab also supports compliance features for managing access controls and auditing.
  • Integration and Extensibility: Integrates with various third-party tools and services, allowing teams to customize their development workflows. It supports integrations with chat tools, issue trackers, monitoring systems, and more.
  • Community and Enterprise Editions: GitLab is available in both Community Edition (CE), which is open-source and free to use, and Enterprise Edition (EE) with additional features and support for enterprise-grade deployments.

GitLab is popular among development teams for its comprehensive feature set, flexibility, and support for the entire DevOps lifecycle from planning to monitoring. Whether used by small teams or large enterprises, GitLab helps streamline collaboration, improve productivity, and accelerate software delivery.

Recommended Online Training: Gitlab / GitLab CI For Beginners: Become a DevOps Expert Now

GitLab vs GitHub

GitLab and GitHub are both widely used platforms for managing Git repositories and supporting collaborative software development, but they have distinct features and target audiences:

GitHub

  • Community and Open Source Focus:
  • GitHub is renowned for its strong community of open-source developers and projects.
  • It’s often used for hosting public repositories and contributing to open-source software.
  • User Interface and Integration:
  • Known for its intuitive and user-friendly interface, GitHub simplifies code hosting, collaboration, and code review processes.
  • Offers seamless integration with various third-party services and tools, enhancing its versatility in development workflows.
  • Social Coding and Collaboration:
  • Emphasizes social coding features such as pull requests, issue tracking, and project boards.
  • Facilitates community collaboration through discussions, forks, and contributions to public repositories.
  • Marketplace and Ecosystem:
  • GitHub Marketplace provides a range of integrations and tools for developers, enhancing productivity and project management capabilities.
  • Supports a broad ecosystem of plugins, extensions, and integrations that extend its functionality.
  • Enterprise Solutions:
  • GitHub offers GitHub Enterprise, a self-hosted version with additional security, compliance, and management features tailored for enterprise use.

GitLab

  • Integrated DevOps Platform:
  • GitLab positions itself as a complete DevOps platform with built-in CI/CD pipelines, code review, issue tracking, and more.
  • Provides a unified experience for planning, managing, and deploying software projects.
  • Built-in CI/CD:
  • GitLab includes robust Continuous Integration (CI) and Continuous Deployment (CD) capabilities directly integrated into the platform.
  • Enables automated testing, building, and deploying of applications without relying on external services.
  • Customization and Flexibility:
  • Offers extensive customization options and flexibility, supporting self-hosted deployments and allowing organizations to tailor the platform to their needs.
  • Provides features like customizable workflows, group-level permissions, and extensive API support for integration with other tools.
  • Security and Compliance:
  • Focuses on security with built-in security scanning tools, compliance features, and role-based access controls.
  • Suitable for organizations with stringent security and compliance requirements.
  • Community and Enterprise Editions:
  • GitLab is available in both Community Edition (CE), which is open-source, and Enterprise Edition (EE) with additional features and enterprise-grade support.

Summary

  • GitHub is ideal for open-source projects, community-driven development, and teams looking for a user-friendly interface with strong social coding features.
  • GitLab is suited for organizations and teams seeking an integrated DevOps platform with built-in CI/CD, extensive customization options, and robust security features.

Choosing between GitHub and GitLab depends on factors such as project scope, team size, desired integration capabilities, and preferences for self-hosting versus cloud-based solutions. Both platforms excel in their respective strengths, catering to a wide range of development workflows and collaboration needs.

Linux Server 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 your Linux Server

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)

Install GitLab Prerequisites

GitLab 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

Install 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

Install GitLab 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 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!

Access GitLab Web Interface

GitLab 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.

GitLab Login

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.

GitLab Change Password

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

GitLab Dashboard

We have reached the main screen of the web application.

Click on “Configure GitLab”.

Configure GitLab Server

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.

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 (PAID LINK) by Joost Evertse.

Final Thoughts

Setting up GitLab on CentOS 8 opens doors to efficient code management and collaboration within your team. With this guide, you can seamlessly integrate GitLab into your development workflow.

For professional assistance with installing GitLab on CentOS 8 or any other server-related tasks, check out my services on Fiverr: Linux Expert Services.

Let’s enhance your development process together!

Alaric Bird

Alaric Bird is a seasoned Linux System Administrator with over a decade of experience in managing and optimizing Linux-based servers and infrastructure. Known for his expertise in server deployment, security hardening, and performance tuning, Alaric has a deep understanding of various Linux distributions, including Ubuntu, CentOS, and Red Hat Enterprise Linux. His skills extend to cloud platforms like AWS, where he effectively manages virtual private servers and services. Alaric is also proficient in scripting languages such as Bash and Python, which he uses to automate routine tasks, enhancing efficiency and reliability. With a strong commitment to continuous learning, he stays updated with the latest developments in open-source technologies and best practices. His problem-solving abilities, combined with excellent communication skills, make him a valuable asset to any IT team. In addition to his technical expertise, Alaric is passionate about mentoring junior administrators and fostering a collaborative environment.

View Comments

  • 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

  • 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.

  • 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

  • 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'

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

    Thanks, D

  • 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.

Share
Published by
Alaric Bird

Recent Posts

Puppy Linux: Fast and Simple OS

Puppy Linux is a fast, lightweight OS designed for speed and simplicity, perfect for old…

1 day ago

Change Apache Document Root in Linux

Learn how to change Apache document root in Linux by following this step-by-step guide. Adjust…

2 weeks ago

How to Change Apache Port in Linux

Discover how to change Apache port in Linux easily. Follow our simple guide to modify…

2 weeks ago

How to Create Virtual Host in Apache Server

Learn how to create a virtual host in Apache Server with this comprehensive guide. Set…

3 weeks ago

10 Practical Tasks for RHCSA Exam with Solutions

Discover 10 practical tasks for the RHCSA exam with step-by-step solutions. Boost your Linux skills…

3 weeks ago

Ultimate Fail2ban Configuration Guide

Discover the ultimate Fail2ban configuration guide. Learn how to set up, customize, and optimize Fail2ban…

4 weeks ago

This website uses cookies.