Welcome to our guide on how to install GitLab CE on Ubuntu 20.04 & Ubuntu 18.04. GitLab is a fully-featured platform for accelerated software development. It provides up to scratch features like integrated CI/CD, Kubernetes integration, Auto DevOps, GitLab Container Registry e.t.c.

In our previous guide, we covered how Install Gitlab CE on CentOS / Fedora. Follow below steps to Install Gitlab CE on Ubuntu 20.04 / Ubuntu 18.04.

Step 1: Update system & install dependencies

Kickoff the installation by ensuring your system is updated:

sudo apt update
sudo apt upgrade -y

Install GitLab dependencies below:

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

Step 2: Configure Postfix Send-Only SMTP Server

GitLab should be able to send emails to you on Git activities. Configure Postfix SMTP Server using the guide below:

Install and configure Postfix as a Send-Only SMTP Server on Ubuntu

Step 3: Add the GitLab CE Repository

Once you have all pre-requisites installed, proceed to add GitLab repository to your Ubuntu 18.04 / Debian 9 by running the command:

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

Installation output:

Detected operating system as Ubuntu/focal.
Checking for curl...
Detected curl...
Checking for gpg...
Detected gpg...
Running apt-get update... done.
Installing apt-transport-https... done.
Installing /etc/apt/sources.list.d/gitlab_gitlab-ce.list...done.
Importing packagecloud gpg key... done.
Running apt-get update... done.

The repository is setup! You can now install packages.

The repository contents are added to:

$ cat /etc/apt/sources.list.d/gitlab_gitlab-ce.list 
# this file was generated by packages.gitlab.com for
# the repository at https://packages.gitlab.com/gitlab/gitlab-ce

deb https://packages.gitlab.com/gitlab/gitlab-ce/ubuntu/ bionic main
deb-src https://packages.gitlab.com/gitlab/gitlab-ce/ubuntu/ bionic main

Step 4: Install GitLab CE on Ubuntu 20.04 / 18.04 Linux

Once the repository has been added, install GitLab CE on Ubuntu 20.04/18.04 using the apt package manager command:

sudo apt update
sudo apt -y install gitlab-ce

Installation output:

It looks like GitLab has not been configured yet; skipping the upgrade script.

       *.                  *.
      ***                 ***
     *****               *****
    .******             *******
    ********            ********

     _______ __  __          __
    / ____(_) /_/ /   ____ _/ /_
   / / __/ / __/ /   / __ `/ __ \
  / /_/ / / /_/ /___/ /_/ / /_/ /

Thank you for installing GitLab!

Edit the GitLab configuration file to set hostname and other parameters:

$ sudo vim /etc/gitlab/gitlab.rb

When done, start your GitLab instance by running the following command:

sudo gitlab-ctl reconfigure

All GitLab services should be started after configuration.

$ sudo gitlab-ctl status
run: alertmanager: (pid 9775) 5787s; run: log: (pid 12211) 96423s
run: gitaly: (pid 9785) 5787s; run: log: (pid 12018) 96427s
run: gitlab-monitor: (pid 9797) 5786s; run: log: (pid 12048) 96426s
run: gitlab-workhorse: (pid 9810) 5786s; run: log: (pid 11992) 96428s
run: logrotate: (pid 18721) 2185s; run: log: (pid 11994) 96428s
run: nginx: (pid 12043) 5463s; run: log: (pid 11993) 96428s
run: node-exporter: (pid 9836) 5784s; run: log: (pid 12042) 96427s
run: postgres-exporter: (pid 9841) 5784s; run: log: (pid 12213) 96423s
run: postgresql: (pid 9847) 5784s; run: log: (pid 11977) 96428s
run: prometheus: (pid 9855) 5783s; run: log: (pid 12206) 96424s
run: redis: (pid 9868) 5783s; run: log: (pid 11976) 96428s
run: redis-exporter: (pid 9870) 5783s; run: log: (pid 12106) 96426s
run: sidekiq: (pid 15215) 4153s; run: log: (pid 11979) 96428s
run: unicorn: (pid 15343) 4127s; run: log: (pid 11978) 96428s

Step 5: Access GitLab CE Web Interface

Once the installation of GitLab CE on Ubuntu 18.04 / Debian 9 is done, open the URL http://gitlab.example.com on your browser to finish the installation of Gitlab.

On the first screen, you’ll be asked to change the root user password.

install gitlab centos 7 fedora 29 set root password 01

Provide the new password and verify then click “Change your password” button.

Login with root as username and password provided.

install gitlab ubuntu 18.04 debian 9 root login

GitLab Dashboard should look like below.

install gitlab ubuntu 18.04 debian 9 interface

Step 5: Secure Gitlab CE with SSL Certificate

Read our next article below on how to configure your GitLab server to be accessible via HTTPS

How To Secure GitLab Server with SSL Certificate

GitLab Administrations cheats

Whenever you edit GitLab configuration file – /etc/gitlab/gitlab.rb,reconfigure GitLab service by running:

sudo gitlab-ctl reconfigure
sudo gitlab-rake gitlab:check

To check the status of all GitLab service, use:

sudo gitlab-ctl status

To stop all GitLab services, use:

sudo gitlab-ctl stop

To restart all GitLab services, use:

sudo gitlab-ctl restart

You can restart a specific service by proving service name at the end

$ sudo gitlab-ctl restart logrotate
ok: run: logrotate: (pid 22824) 0s

If you need LDAP Authentication on your GitLab Server, read:

How to Configure GitLab FreeIPA Authentication

Enjoy running GitLab on Ubuntu 18.04/Debian 9 server and stay connected for more informative and hands-on Linux guides.

GitLab CI Learning Courses:

Git Learning Video Courses:

Your support is our everlasting motivation,
that cup of coffee is what keeps us going!

As we continue to grow, we would wish to reach and impact more people who visit and take advantage of the guides we have on our blog. This is a big task for us and we are so far extremely grateful for the kind people who have shown amazing support for our work over the time we have been online.

Thank You for your support as we work to give you the best of guides and articles. Click below to buy us a coffee.


Please enter your comment!
Please enter your name here