Day-1&2 Installing and Configuring GitLab on Ubuntu

Muhammad HassanMuhammad Hassan
3 min read

I am using a DigitalOcean free account, which gives me $200 in credits. You can use my referral code to get the same offer: https://m.do.co/c/1fd4ef5ca074.

To set up the server, I created a Droplet with the following specifications:

  • 8GB RAM, 4-core CPU (recommended for optimal performance)

  • Ubuntu 24.04 LTS (must use one of: 20.04 LTS, 22.04 LTS, or 24.04 LTS)

Additionally, I configured my DNS A record to point my GitLab subdomain (gitlab.hassandevops.site) to my server's public IP address using GoDaddy as my domain registrar. Make sure to do this in your GoDaddy DNS settings before proceeding.

GitLab is a popular DevOps platform that allows you to manage repositories, CI/CD pipelines, and more. In this guide, we will walk through the installation and initial configuration of GitLab on an Ubuntu server.

Step 1: Install and Configure Dependencies

Before installing GitLab, ensure that your system is up-to-date and that necessary dependencies are installed. Run the following commands:

sudo apt-get update
sudo apt-get install -y curl openssh-server ca-certificates tzdata perl

Additionally, install Postfix (or an alternative SMTP solution) to enable notification emails:

sudo apt-get install -y postfix

During the Postfix installation, a configuration screen may appear. Choose 'Internet Site' and press enter. Use your server's external DNS for 'mail name', then press enter. If additional configuration screens appear, accept the defaults by pressing enter.

Step 2: Add the GitLab Package Repository and Install GitLab

To install GitLab, first add the GitLab package repository:

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

Then, install GitLab with the following command. Be sure to replace https://gitlab.example.com with your desired GitLab URL:

sudo EXTERNAL_URL="https://gitlab.example.com" apt-get install gitlab-ee

If you wish to specify a particular version of GitLab, use:

# List available versions:
apt-cache madison gitlab-ee

# Install a specific version:
sudo EXTERNAL_URL="https://gitlab.example.com" apt-get install gitlab-ee=16.2.3-ee.0

# Pin the installed version to prevent auto-updates:
sudo apt-mark hold gitlab-ee

# Show pinned versions:
sudo apt-mark showhold

i use this for installing GitLab on gitlab.hassandevops.site, use:

sudo EXTERNAL_URL="https://gitlab.hassandevops.site" apt-get install gitlab-ee

# List available versions:
apt-cache madison gitlab-ee

# Install a specific version:
sudo EXTERNAL_URL="https://gitlab.hassandevops.site" apt-get install gitlab-ee=16.2.3-ee.0

# Pin the installed version:
sudo apt-mark hold gitlab-ee

# Show pinned versions:
sudo apt-mark showhold

Step 3: Access GitLab and Log In

Once installation is complete, navigate to your GitLab URL in a browser.

If you did not specify a custom administrator password, a randomly generated password will be stored in:

/etc/gitlab/initial_root_password

Use this password along with the username root to log in.


With GitLab installed, you can now configure your repositories, CI/CD pipelines, and user management. For further customization and security enhancements, check out the official GitLab documentation.

GitLab Access URL:

https://gitlab.hassandevops.site

0
Subscribe to my newsletter

Read articles from Muhammad Hassan directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Muhammad Hassan
Muhammad Hassan

Hey there! I'm currently working as an Associate DevOps Engineer, and I'm diving into popular DevOps tools like Azure Devops,Linux, Docker, Kubernetes,Terraform and Ansible. I'm also on the learning track with AWS certifications to amp up my cloud game. If you're into tech collaborations and exploring new horizons, let's connect!