Site icon CentLinux

How to install GitLab on CentOS 8

Share on Social Media

Learn how to install GitLab on CentOS 8 with our step-by-step guide. Set up dependencies, configure repositories, and deploy GitLab for efficient source code management and DevOps automation. #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:

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.

How to install GitLab on CentOS 8

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:

User Interface and Integration:

Social Coding and Collaboration:

Marketplace and Ecosystem:

Enterprise Solutions:

GitLab

Summary

Read Also: How to Install GitLab CE on Rocky Linux 9

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.

Recommended Training: GitLab CI/CD Bootcamp| Zero to Hero| Certification Prep 2024 from Karan Gupta

Linux Server Specification

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

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.

Final Thoughts

Installing GitLab on CentOS 8 enables you to create a powerful self-hosted Git repository and DevOps platform for managing source code, CI/CD pipelines, and team collaboration.

By following the installation steps, configuring the necessary dependencies, and setting up your GitLab instance, you can efficiently manage projects and streamline software development. Once installed, ensure proper firewall and SSL configurations for enhanced security and optimal performance.

From setting up scalable AWS solutions to managing complex Linux environments, I’ve got you covered. Visit my Fiverr profile to get started.

Let’s enhance your development process together!

FAQs

What is GitLab, and why is it used?
GitLab is a web-based DevOps platform that provides Git repository management, CI/CD pipelines, issue tracking, and collaboration tools for software development teams.

What are the prerequisites for installing GitLab on CentOS 8?
Before installing GitLab, ensure that your system has at least 4GB of RAM, a supported CPU, and that Postfix or another mail server is installed for email notifications.

Why do I need to configure a firewall for GitLab?
GitLab uses HTTP (port 80) and HTTPS (port 443) for web access and SSH (port 22 or a custom port) for Git repository access. Configuring the firewall ensures proper accessibility and security.

What are the key configuration steps after installing GitLab?
After installation, you need to set up an admin password, configure external URL settings, enable SSL for security, and fine-tune performance settings based on your workload.

How do I access GitLab after installation?
Once installed and started, GitLab can be accessed through a web browser using your server’s IP address or domain name, where you can log in and start managing repositories.

Exit mobile version