How to Setup and Configure Your Own GitLab Server on Ubuntu 20.04

Prabhat Kumar Sahu
3 min readAug 21, 2020

I have created a video tutorial. You can watch that for your reference.

Youtube Tutorial

GitLab CE(Community Edition) is a free and opensource web-based git manager tool & it’s written in Ruby.

GitLab CE is generally used for Software development teams, it has a lot of features like version control, code review, monitoring, CI & CD, issue management, wiki, etc.

GitLab allows you to host your Git repository that can be accessed from either your local LAN / WAN / local server or (if you have an available public IP address) from outside your company. The community edition is open-sourced and freely available to install and setup.

There are three different editions of GitLab available, Community Edition (CE), Enterprise Edition (EE), and a GitLab-hosted version.

In this article, we will go step by step to install the latest version of GitLab CE on Ubuntu 20.04 / 18.04 Server.

Below should be your laptop or desktop minimum configuration:

  1. RAM: Gitlab recommends 4 GB for Gitlab Setup
  2. 2 CPU cores.
  3. (optional) Domain or subdomain pointing to the server IP address.

Installation

Login to your Ubuntu 20.04 / 18.04 system and run the following commands in the terminal to install GitLab dependencies.

The first thing you need to run is the update or upgrade.

sudo apt update

Then install the necessary dependencies

sudo apt-get install -y curl openssh-server ca-certificates

If you want GitLab to send notification emails you can either install Postfix from the command below or if you want to use another transactional mail service such as SendGrid, MailChimp, etc you can configure using GitLab SMTP settings after installation.

sudo apt-get install -y postfix

During the installation on Postfix, you will be asked how to configure Postfix. if you choose Internet site, then enter either the domain or the IP address of the server. Or you can always select Local Only Postfix configuration.

Check this digital ocean blog for more information regarding how to setup Postfix.

Installing GitLab CE

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

Once it is done and the repository is enabled you can install GitLab CE package by using this command below

sudo apt-get install gitlab-ce

If you want to set up using your server address, do the below

sudo EXTERNAL_URL="http://gitlabce.example.com" apt-get install gitlab-ce

Once you have the package installed, you can run the provided configuration utility. It provides an automatic configuration. You can modify things later if you need to.

sudo gitlab-ctl reconfiguregitlab-ctl start

When the configuration is done, your server will be ready to use.

Access GitLab through the Web Interface

Open your web browser and type the URL that you mentioned while installing or check your local IP address and enter in the browser you will get GitLab web interface.

Eg:

https://your_gitlab_domain_or_server_IP

Once you are done, you will get a screen to register and log in. Then you can easily follow up and configure.

If you want to uninstall GitLab CE completely run this command below

sudo apt-get remove gitlab-ce

sudo rm -rf /var/opt/gitlab

Kill all live process

sudo pkill -f gitlab

Remove paths

sudo rm -rf /opt/gitlab

sudo rm -rf /etc/gitlab

sudo rm -rf /var/opt/gitlab

Then restart your machine.

Thanks

If you have any questions, recommendations, or critiques, I can be reached via Twitter or via my mail. Feel free to reach out to me.

--

--