7

Install GitLab CE on CentOS 7 | Fedora 34/33/32/31/30

 3 years ago
source link: https://computingforgeeks.com/install-gitlab-ce-on-centos-fedora/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
Install GitLab CE on CentOS 7

In this guide, we will cover the installation of Gitlab on CentOS 7 / Fedora 34/33/32/31/30. 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.

Install GitLab on CentOS 7 / Fedora 34/33/32/31/30

The start of the actual installation of Gitlab on CentOS 7 / Fedora 34/33/32/31/30 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-python

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

--- CentOS 7 ---
sudo yum install postfix

--- Fedora ---
sudo dnf 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.

Create a new repository file for GitLab:

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

Then add the following lines:

[gitlab-ce]
name=gitlab-ce
baseurl=https://packages.gitlab.com/gitlab/gitlab-ce/el/7/$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
metadata_expire=300

Step 3: Install Gitlab CE on CentOS 7 / Fedora 34/33/32/31/30

Install GitLab CE by running the command:

sudo EXTERNAL_URL="http://gitlab.example.com" yum install -y gitlab-ce

Replace EXTERNAL_URL with your domain name for Gitlab.

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!

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.

You’re asked to create a new password for your account. Set a new password for root user then click “Change your password“.

Login with the username root and password set above

You should be directed to the Gitlab administration dashboard. You can update your user profiles and add other Gitlab users & groups.

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:

How to disable GitLab User registration on Login page

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.

How to Secure GitLab server with SSL certificate

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.

Configure GitLab FreeIPA LDAP Authentication

Visit GitLab Documentation page for more learning on GitLab administration.

GitLab CI Learning Courses:

Git Learning Video Courses:

Related articles:


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK