How to Install GitLab on Ubuntu 18.04 Bionic Beaver

Install GitLab on Ubuntu 18.04

In this article, we will have explained the necessary steps to install and configure GitLab on Ubuntu 18.04 LTS. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

GitLab is an open-source web-based application used for managing Git-repositories for collaborative development. Its main purpose is managing multiple software development projects and its files among members of a team or an organization. It can also provide issue and time tracking, reviews, branching, and many more development-related features that use Git functionality.

Install GitLab on Ubuntu

Step 1. First, before you start installing any package on your Ubuntu server, we always recommend making sure that all system packages are updated.

sudo apt update
sudo apt upgrade

Step 2. Installing Required Dependencies.

Install necessary packages in order for GitLab:

sudo apt update
sudo apt install curl openssh-server ca-certificates

Next, run the commands below to install Postfix MTA for notifications:

debconf-set-selections <<< "postfix postfix/mailname string $(hostname -f)"
debconf-set-selections <<< "postfix postfix/main_mailer_type string 'Internet Site'"
sudo apt install postfix

Step 3. Installing GitLab on Ubuntu 18.04.

Gitlab comes from its own repository. The Gitlab developers wrote a convenient install script for Ubuntu and Debian systems to make the setup simple. Grab the script and run it:

curl | sudo bash

After adding the repository, we can now proceed to download the GitLab CE package:

sudo apt install gitlab-ce

Step 4. Configuring GitLab.

After a successful installation, we will need to configure our URL to be used by our application.

sudo nano /etc/gitlab/gitlab.rb

Now modify the “external_url” variable to utilize your domain.

external_url ''

After that, we will need to set up security measures for our GitLab Server. Paste the following under the “#GitLab Nginx” section to override some settings.

nginx['redirect_http_to_https'] = true
nginx['ssl_certificate'] = "/etc/letsencrypt/live/"
nginx['ssl_certificate_key'] = "/etc/letsencrypt/live/"
nginx['ssl_dhparam'] = "/etc/gitlab/ssl/dhparams.pem"

We are then required to run a command to reconfigure GitLab settings:

sudo gitlab-ctl reconfigure

Step 5. Setting up a Firewall.

Ubuntu’s built-in firewall must be configured to allow three protocols: SSH, HTTP, and HTTPS. To allow the three protocols, execute the following:

sudo ufw allow OpenSSH
sudo ufw allow http
sudo ufw allow https

Step 6. Configure GitLab through the Web Interface.

Now that you have configured the GitLab URL you can start with the initial configuration through the GitLab web interface. Launch your web browser and navigate to:

That’s all you need to do to install GitLab on Ubuntu 18.04. I hope you find this quick tip helpful. If you have questions or suggestions, feel free to leave a comment below.