In this tutorial, we will show you how to install Gitlab on your CentOS 8. For those of you who didn’t know, Gitlab is a graphical implementation of git, it is open-source repository management and version control system. GitLab is developed on Ruby on Rails. Using GitLab you can host your source code on your own server. This ensures the security of the code and gives you total freedom on the number of users as well as the number of repositories and files. GitLab provides you with a platform to collaborate on projects and to keep track of changes in code. GitLab has widely used for software development and version control-related tasks. In many ways, it is similar to GitHub, except you can install it on your own server.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘
sudo‘ to the commands to get root privileges. I will show you through the step-by-step installation of Gitlab on a CentOS 8.
- A server running one of the following operating systems: CentOS 8.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
non-root sudo useror access to the
root user. We recommend acting as a
non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.
Install GitLab on CentOS 8
Step 1. First, let’s start by ensuring your system is up-to-date.
sudo dnf clean all sudo dnf update
Step 2. Installing dependencies.
Before we going to install Gitlab, we have to install some prerequisites like ssh and mail services:
sudo dnf install curl policycoreutils-python openssh-server
Next, install Postfix service to send notification emails, and enable it to start at system boot, then check if it is up and running using the following commands:
sudo dnf install postfix
Now enable and start the ssh and Postfix services as follows:
sudo systemctl start postfix sudo systemctl enable postfix sudo systemctl status postfix
Step 3. Installing GitLab on CentOS 8.
First, add the GitLab package repository to your system by running the following script:
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
Next, install the GitLab package using the following command and make sure to change ‘
http://gitlab.idroot.us‘ to the URL at which you want to access your GitLab instance from a web browser:
EXTERNAL_URL="http://gitlab.idroot.us" dnf install gitlab-ce
*If you are not comfortable installing the repository through a piped script, you can find the entire script here.
Now start the configuration by using the
Step 4. Configure Firewall for Gitlab.
You need to open port 80 (HTTP) and 443 (HTTPS) to allow connections in the system firewall:
firewall-cmd --permanent --add-service=80/tcp firewall-cmd --permanent --add-service=443/tcp systemctl reload firewalld
Step 5. Accessing Gitlab.
Gitlab will be available on HTTP port 80 by default. Open your favorite browser and navigate to
http://server-ip-address. You’re asked to create a new password for your account. Set a new password for the root user then click “Change your password“.
Congratulations! You have successfully installed Gitlab. Thanks for using this tutorial for installing Gitlab on CentOS 8 system. For additional help or useful information, we recommend you to check the official Gitlab website.