We are committed to provide service 24 X 7

Deals, Shopping, Training, Tools

Learn how to – Install GitLab CE on CentOS 7 | Fedora 37/36/35/34/33

Learn how to – Install GitLab CE on CentOS 7 | Fedora 37/36/35/34/33.

In this guide, we will cover the installation of Gitlab on CentOS 7 / Fedora 37/36/35/34/33. GitLab is Git-based fully featured platform for accelerated software development. It provides up to scratch features like integrated CI/CD, Auto DevOps, Kubernetes integration, GitLab Container Registry e.t.c.

Since this installation is for Gitlab Community Edition, more features can be unlocked by moving to subscription. check the GitLab subscriptions for details.

Some of its key features include:

  • Git repository management: GitLab allows users to host and manage their Git repositories, including support for private and public repositories.
  • Continuous integration and deployment: GitLab includes built-in support for continuous integration and deployment, allowing users to automatically build, test, and deploy their code.
  • Collaborative development: GitLab provides tools for users to collaborate on code development, including merge requests, code reviews, and issue tracking.
  • Wiki and documentation: GitLab includes a built-in wiki and documentation management feature, allowing users to easily create and manage documentation for their projects.
  • Access control: GitLab allows users to set granular access controls for their repositories, including branch-level permissions and protected branches.
  • Plugins and integrations: GitLab supports a wide range of plugins and integrations, including support for popular tools such as Jira, Slack, and Jenkins.

Install GitLab on CentOS 7 / Fedora 37/36/35/34/33

The start of the actual installation of Gitlab on CentOS 7 / Fedora 37/36/35/34/33 is this section. Gitlab installation requires your server to have a minimum of 4GB ram and 2 CPU cores.

If you do an installation on a system with lower hardware specifications, you may experience tortoise-like performance.

Step 1: Install necessary dependencies

Install Dependencies on CentOS 7:

sudo yum -y update
sudo yum -y install epel-release curl vim policycoreutils-python

For Fedora:

sudo dnf -y install curl vim policycoreutils-python3

If you want to install and use local Postfix server for sending notifications, then install Postfix:

### CentOS 7 ###
sudo yum -y install postfix

### Fedora ###
sudo dnf -y install postfix

Start and enable Postfix service after the installation.

sudo systemctl enable postfix
sudo systemctl start postfix

For configuration of external email relay service after setting up GitLab, check configure an external SMTP server .

Step 2: Add the GitLab CE Repository

GitLab provides omnibus packages from a repository. These packages are compiled specifically for CentOS but can be installed on a Fedora system.

CentOS 7:

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

Fedora 37/36/35/34/33:

Create a new repository file for GitLab:

sudo vim /etc/yum.repos.d/gitlab-ce.repo

Then add the following lines:

[gitlab_gitlab-ce]
name=gitlab_gitlab-ce
baseurl=https://packages.gitlab.com/gitlab/gitlab-ce/el/8/$basearch
repo_gpgcheck=1
gpgcheck=1
enabled=1
gpgkey=https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey
       https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey/gitlab-gitlab-ce-3D645A26AB9FBD22.pub.gpg
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300

[gitlab_gitlab-ce-source]
name=gitlab_gitlab-ce-source
baseurl=https://packages.gitlab.com/gitlab/gitlab-ce/el/8/SRPMS
repo_gpgcheck=1
gpgcheck=1
enabled=1
gpgkey=https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey
       https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey/gitlab-gitlab-ce-3D645A26AB9FBD22.pub.gpg
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300

Step 3: Install Gitlab CE on CentOS 7 / Fedora

Install GitLab CE by running the command:

sudo yum install -y gitlab-ce

Wait for the installation to complete then proceed to configure it.

Step 4: Configure Gitlab CE on CentOS 7 / Fedora

You need to set URL on which GitLab will be reachable from outside. This is done by editing GitLab configuration file /etc/gitlab/gitlab.rb

sudo vim /etc/gitlab/gitlab.rb

URL can be set on:

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

There are many other GitLab CE Configuration Settings that you can set to fit your preference. Once done, save the file and run Gitlab reconfiguration script.

sudo gitlab-ctl reconfigure

This will start a Chef local execution to configure Gitlab. When it finishes, you should get a success message.

................
Running handlers:
Running handlers complete
Chef Client finished, 438/620 resources updated in 04 minutes 44 seconds
gitlab Reconfigured!

All GitLab services should be started after configuration.

sudo gitlab-ctl status

If you have an active firewall, allow http, https and ssh services.

sudo firewall-cmd --permanent --add-service={ssh,http,https} --permanent
sudo firewall-cmd --reload

Open your browser and go to URL http://gitlab.example.com to finish the installation of Gitlab.

A password for root user is randomly generated and stored for 24 hours in /etc/gitlab/initial_root_password. You can check the password with the commands below:

$ cat /etc/gitlab/initial_root_password
# WARNING: This value is valid only in the following conditions
#          1. If provided manually (either via `GITLAB_ROOT_PASSWORD` environment variable or via `gitlab_rails['initial_root_password']` setting in `gitlab.rb`, it was provided before database was seeded for the first time (usually, the first reconfigure run).
#          2. Password hasn't been changed manually, either via UI or via command line.
#
#          If the password shown here doesn't work, you must reset the admin password following https://docs.gitlab.com/ee/security/reset_user_password.html#reset-your-root-password.

Password: kOtOjWp7v70OjkjtadnSJAhcDbCNo9nTNGVC5UoSCyE=

# NOTE: This file will be automatically deleted in the first reconfigure run after 24 hours.

Use this password with username root to login.

Reset root user password

Go to root user profile > Preferences

Then Password section

Input the current password, and set new one.

Step 5: Disable User Sign Up ( Recommended)

By default, GitLab allows new users to sign up, this is not usually the case as users are created manually by SysAdmin or user information pulled from external authentication systems such as LDAP.

You can disable this setting to have a secure access management. See:

Step 6: Secure GitLab with SSL Certificate (Recommended)

SSL is the de facto protocol for securely accessing services in the internet. You can make use of free SSL certificates such as Let’s Encrypt to secure your GitLab server. Refer to our previous guide below.

Step 7: Enable LDAP Authentication (Optional)

For those who use LDAP as a primary method of authentication, GitLab can be configured to use an LDAP server such as FreeIPA to authenticate users.

Visit GitLab Documentation page for more learning on GitLab administration.

Related articles:

9
445.321,80