Skip to content
Cloudbricks.dev logo

How to Install and Configure GitLab Community Edition

Install and configure GitLab Community Edition on Linux, covering the initial setup, the required configuration changes, and how to get a project running through its CI/CD pipeline.

Kishore 2 min read

GitLab logo

GitLab Community Edition is an open-source DevSecOps Platform

GitLab brings Automated tasks to improve the efficiency. Supports

  • Continuous Integration and Delivery
  • Workflows
  • Source Code Management
  • Automated Software delivery

Installation:

For this Guide, we will install GitLab community edition on Alma Linux

  1. Prepare Linux Machine

For Lab purpose I have created a VM with the following specs

GitLab VM
  • 8vCPU
  • 16GB RAM
  • 100GB free disk space
  • Alma Linux 9 with static IP
  1. Create the Virtual Machines manually or using Packer template and clone using Terraform/OpenTofu. I have used the OpenTofu code, which will create VM with the required configuration Tofu/Terraform code to create GitLab VM from template
  2. Login to GitLab VM and run the following commands.
sudo systemctl disable --now firewalld

this stops the firewall service and disable it Screenshot 3 from the GitLab Community Edition walkthrough 4. install the prerequisites using the following command:

sudo dnf install -y curl policycoreutils openssh-server perl

Screenshot 4 from the GitLab Community Edition walkthrough 5. Add the GitLab package repository


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

Screenshot 5 from the GitLab Community Edition walkthrough 6. Install the GitLab package using the following command

sudo EXTERNAL_URL="http://repo.cloudbricks.local" dnf install -y gitlab

replace the EXTERNAL_URL with the one you need Screenshot 6 from the GitLab Community Edition walkthrough

Post completion of installation, run the fowllowing command to check the status of gitlab.

gitlab-ctl status

Screenshot 7 from the GitLab Community Edition walkthrough 7. access the GitLab URL as mentioned in the previous steps. To get the initial root password run the following command

cat /etc/gitlab/initial_root_password

Screenshot 8 from the GitLab Community Edition walkthrough In my case, I will be accessing using http://repo.cloudbricks.local with root as username and password from above command

  1. Change the root password immediately by going to root avatar > Edit profile > Password Screenshot 9 from the GitLab Community Edition walkthrough Screenshot 10 from the GitLab Community Edition walkthrough Screenshot 11 from the GitLab Community Edition walkthrough

Configure HTTPS:
  1. Login to GitLab VM and edit /etc/gitlab/gitlab.rb Screenshot 12 from the GitLab Community Edition walkthrough

  2. uncomment the following

nginx['ssl_certificate'] = "/etc/gitlab/ssl/#{node['fqdn']}.crt""

nginx['ssl_certificate_key'] = "/etc/gitlab/ssl/#{node['fqdn']}.key"

Uncomment and change this line from False to True nginx['redirect_http_to_https'] = true

nginx['ssl_client_certificate'] = "/etc/gitlab/ssl/ca.crt"

Screenshot 13 from the GitLab Community Edition walkthrough

  1. create a directory called ssl under /etc/gitlab Screenshot 14 from the GitLab Community Edition walkthrough

  2. Copy ADCS generated SSL certs to /etc/gitlab/ssl Screenshot 15 from the GitLab Community Edition walkthrough

  3. change the external url from http to https - external_url 'https://repo.cloudbricks.local' Screenshot 16 from the GitLab Community Edition walkthrough

  4. Once the SSL certificates are copied and gitlab.rb is edited properly, run the following command

gitlab-ctl reconfigure
  1. Refresh the Gitlab URL/ open new tab and access the url Screenshot 17 from the GitLab Community Edition walkthrough

Watch the video on How to install and configure GitLab community Edition