GitLab is a complete DevOps platform, delivered as a single application. From project planning and source code management to CI/CDmonitoring, and security.

Step 1 – Remove unwanted packages

apt purge nginx apache2* 

Completely remove nginx and apache2 from your system. because gitlab come with own nginx.(It is not necessary remove this package. You can also configure gitlab with apache2 and default nginx but it is complex process. The best practices is to install gitlab on separate server)

Step 2 – Installing the Dependencies

Since this is our first time using apt during this session, we can refresh the local package index and then install the dependencies by typing:

sudo apt-get update

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

Step 3 – Installing GitLab

Add the GitLab package repository.

cd /tmp

curl -LO | sudo bash

sudo apt install gitlab-ce -y

Step 4 – Editing the GitLab Configuration File

sudo vi /etc/gitlab/gitlab.rb

Change external_url to ‘’

external_url ''

In case of https set following variables after lets encrypt certificate generation

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

In case of SMTP setting please update following variables

gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = ""
gitlab_rails['smtp_port'] = 587
gitlab_rails['smtp_user_name'] = "smtp user"
gitlab_rails['smtp_password'] = "smtp password"
gitlab_rails['smtp_domain'] = ""
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_tls'] = false
gitlab_rails['smtp_openssl_verify_mode'] = 'peer'

Once your configuration is done according to requirement execute below command

sudo gitlab-ctl reconfigure 

Step 5 – Adjusting the Firewall Rules

If your ufw i.e universal firewall active, allow below port to accessible from intranet

sudo ufw allow 22 

sudo ufw allow 8080 

sudo ufw enable

sudo ufw status

Step 6 – Configuration URL in /etc/hosts file

The /etc/hosts is an operating system file that translate hostnames or domain names to IP addresses.

sudo vi /etc/hosts

Add following line at bottom of file

Step 7 – Open Web browser and enter “”

On your first visit, you’ll be redirected to a password reset screen. Provide the password for the initial administrator account and you will be redirected back to the login screen. Use the default account’s username root to login.

Congratulations! If you get this page then you successfully install gitlab on bare ubuntu server.