In this guide, we will cover the installation of Gitlab on CentOS 7 / Fedora 36/35/34/33/32. 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 36/35/34/33/32
The start of the actual installation of Gitlab on CentOS 7 / Fedora 36/35/34/33/32 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
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.
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
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
sudo vim /etc/gitlab/gitlab.rb
URL can be set on:
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.