How to Install Gitlab on Ubuntu 18.04

Install Gitlab on Ubuntu 18.04

In this tutorial we are going to learn how to install Gitlab on Ubuntu 18.04. We will also install and configure its prerequisites. Gitlab is a popular git repository hosting application. You can use it to store versioned copies of code and collaborate with others. It provides a web interface that allows you to view syntax-highlighted code, compare diffs, handle merge requests, etc. It is comparable in many ways to Github, except that you can host Gitlab on your own server.

I recommend to use a minimal Ubuntu server setup as a basis for the tutorial, that can be a virtual or a root server image with an Ubuntu 18.04 Bionic Beaver minimal install from a web hosting company or you use our minimal server tutorial to install a server from scratch.

Install Gitlab on Ubuntu 18.04

Step 1. First, ensure your system and apt package lists are fully up-to-date by running the following:

apt-get update -y
apt-get upgrade -y

Step 2. Installing the necessary dependencies.

You’all need to install some basic prerequisite packages for Gitlab:

sudo apt install curl openssh-server ca-certificates postfix

To start and enable to prerequisite packages OpenSSH and Postfix to run on boot, execute the following four commands:

systemctl start sshd
systemctl start postfix

Step 3. Installing Gitlab on Ubuntu 18.04.

Now execute the following command to add Gitlab package server into your repository:

curl -sS | sudo bash

Once download is completed, then the actual GitLab application is ready to be installed with “apt”:

sudo apt install gitlab-ce

Now you will need to run the following command to configure and run GitLab:

gitlab-ctl reconfigure

Step 6. Configure Firewall for GitLab.

Before accessing the GitLab, you will need to allow SSH and HTTP service through UFW firewall:

sudo ufw enable
sudo ufw allow OpenSSH
sudo ufw allow http

Step 7. Accessing Gitlab Web Installation.

Now you can access the Gitlab web install wizard in your browser by entering the domain name or http://your_ip/ to continue your installation.

Congratulation’s! You have successfully install and configured Gitlab on your Ubuntu 18.04 LTS server. Thanks for using this tutorial for installing Gitlab on Ubuntu 18.04 LTS (Bionic Beaver) system.