Red Hat

How to Install Gitlab on Rocky Linux 8

How to Install Gitlab on Rocky Linux 8

What is GitLab?

GitLab is a free and open-source DevOps platform on which programmers can collaborate while developing a source code. The platform was specially created for remote work. So far, GitLab has about 30 million registered users, out of which 1 million are active license users.

Today, we will see how to install GitLab on our system following a few easy-to-follow commands. For this, we have used Rocky Linux 8 as our Operating System.

Requirements:

A valid Domain name mapped to your server

Omnibus GitLab package takes 2.5 GB of space

4 GB RAM (minimum)

CPU: 4 cores (minimum)

Installation Guide:

Step 1: Configure SSH (optional step)

These are optional steps; you can skip them if SSH is already enabled on your system.

Download and install the OpenSSH-server perl package with this command:

sudo dnf install -y curl policycoreutils openssh-server perl

To check the status of the OpenSSH daemon, run the following command:

sudo systemctl status sshd

Enable the daemon with this command:

sudo systemctl enable sshd

Now start the ssh service by running this command:

sudo systemctl start sshd

Step 2: Configure Firewall (optional step)

In this step, we will configure the system firewall to allow HTTP and HTTPS access. This is also an optional step; you can skip it.

To check the status of the firewall, run:

sudo systemctl status firewalld

To open HTTP service on the system firewall, use this command:

sudo firewall-cmd --permanent --add-service=http

Now add HTTPS service on the system firewall with this command:

sudo firewall-cmd --permanent --add-service=https

To update configurations, restart the firewall.

sudo systemctl reload firewalld

Step 3: Install Postfix (optional step)

To send notification emails, we will need to install Postfix. If you want to use another service to deal with notification emails, like SMTP, you can skip this step. You can configure the settings after installation.

To use the Postfix service, install it with the command mentioned below:

sudo dnf install postfix

Once the installation is completed, enable the service with the help of this command:

sudo systemctl enable postfix

Now start the service with this command:

sudo systemctl start postfix

A configuration screen will appear during the installation of Postfix. Select ‘Internet Site’ and press enter. For DNS configuration, use your server’s external DNS for ‘mail name’. In case more screens appear, keep pressing enter to accept the default configurations.

Step 4: Add and Install GitLab package

This is the key step. Here we will download and install GitLab on our system.

To add the GitLab package repository, run this command:

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

To install the package, we will run the command below. Make sure to change https://gitlab.example.com to the URL at which you want to run your GitLab instance.

sudo EXTERNAL_URL="https://gitlab.example.com" dnf install -y gitlab-ee

Once the installation is all done, try accessing the external URL that you gave for GitLab. This will open GitLab login page for you.

A random password will be generated and stored in the /etc/gitlab directory with the name initial_root_password.

To log in, use root as your username and the password stored in the initial_root_password file. The password file will automatically be deleted after 24 hours. Make sure to reset the password.

How to uninstall GitLab

Step 1: Stop GitLab service

Now that we have seen how to install GitLab, let’s also see how can we uninstall this service. To do that, you first need to stop GitLab. Do that by running this command:

sudo gitlab-ctl stop

Step 2: Uninstall GitLab

Now you can uninstall GitLab with this command:

sudo gitlab-ctl uninstall

Step 3: Remove the GitLab package

The uninstall step will not completely uninstall GitLab. You will also have to remove GitLab package. Do that with this command:

sudo yum remove gitlab-ee

After this step, reboot the machine to kill all the previous GitLab processes. GitLab will be completely uninstalled after the reboot.

In this guide, we saw how to install GitLab. Then we also saw how to uninstall it with a help of three easy-to-follow commands. The complete installation will take around 5 to 10 minutes depending on your system specifications. Once it is done, configure GitLab, following these steps. To see how you can install GitLab on Ubuntu 20.04, visit:

https://linuxways.net/ubuntu/how-to-install-gitlab-in-ubuntu-20-04/

Similar Posts