How to Install GitLab on Ubuntu 20.04

Install GitLab on Ubuntu 20.04

In this article, we will have explained the necessary steps to install and configure GitLab on Ubuntu 20.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. GitLab friendly web interface that’s simple and intuitive for just about every user if you want to build your server for code hosting so that you can share and host code and install and set up your server

Install GitLab on Ubuntu 20.04

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
sudo apt install curl openssh-server ca-certificates

Step 2. Install Gitlab on Ubuntu system.

Now we add the GitLab repository:

curl | sudo bash

Once added, you can install the GitLab-CE package on Ubuntu system by using the following command:

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. Now 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. Configure 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. Accessing GitLab CE 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 20.04 LTS Focal Fossa. I hope you find this quick tip helpful. If you have questions or suggestions, feel free to leave a comment below.