How to Install Gitlab on Ubuntu 20.04

GitLab is a web-based DevOps lifecycle tool that provides a Git repository manager providing wiki, issue-tracking, and continuous integration and deployment pipeline features, using an open-source license, developed by GitLab Inc.

Update System.

apt update

apt upgrade -y

Install the Gitlab package dependencies.

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

Add the GitLab Repository.

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

Install Gitlab

Download Gitlab package using following command,

wget --content-disposition https://packages.gitlab.com/gitlab/gitlab-ce/packages/ubuntu/bionic/gitlab-ce_14.1.2-ce.0_amd64.deb/download.deb 

Output:

 root@vps:~#wget --content-disposition https://packages.gitlab.com/gitlab/gitlab-ce/packages/ubuntu/bionic/gitlab-ce_14.1.2-ce.0_amd64.deb/download.deb 
--2021-09-25 14:30:58--  https://packages.gitlab.com/gitlab/gitlab-ce/packages/ubuntu/bionic/gitlab-ce_14.1.2-ce.0_amd64.deb/download.deb
Resolving packages.gitlab.com (packages.gitlab.com)... 104.18.27.123, 104.18.26.123, 2606:4700::6812:1b7b, ...
Connecting to packages.gitlab.com (packages.gitlab.com)|104.18.27.123|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://d20rj4el6vkp4c.cloudfront.net/7/8/ubuntu/package_files/110770.deb?t=1632580558_b2e43c77e717f7367a7d2def229735e03d5b8c31 [following]
--2021-09-25 14:30:58--  https://d20rj4el6vkp4c.cloudfront.net/7/8/ubuntu/package_files/110770.deb?t=1632580558_b2e43c77e717f7367a7d2def229735e03d5b8c31

Install the downloaded .deb package on Ubuntu 20.04 using the below command,

dpkg -i gitlab-ce_14.1.2-ce.0_amd64.deb

Output:

root@vps:~#dpkg -i gitlab-ce_14.1.2-ce.0_amd64.deb 
Selecting previously unselected package gitlab-ce.
(Reading database ... 73374 files and directories currently installed.)
Preparing to unpack gitlab-ce_14.1.2-ce.0_amd64.deb ...
Unpacking gitlab-ce (14.1.2-ce.0) ...
Setting up gitlab-ce (14.1.2-ce.0) ...
It looks like GitLab has not been configured yet; skipping the upgrade script.

       *.                  *.
      ***                 ***
     *****               *****
    .******             *******
    ********            ********
   ,,,,,,,,,***********,,,,,,,,,
  ,,,,,,,,,,,*********,,,,,,,,,,,
  .,,,,,,,,,,,*******,,,,,,,,,,,,
      ,,,,,,,,,*****,,,,,,,,,.
         ,,,,,,,****,,,,,,
            .,,,***,,,,
                ,*,.

     _______ __  __          __
    / ____(_) /_/ /   ____ _/ /_
   / / __/ / __/ /   / __ `/ __ \
  / /_/ / / /_/ /___/ /_/ / /_/ /
  \____/_/\__/_____/\__,_/_.___/

Thank you for installing GitLab!
GitLab was unable to detect a valid hostname for your instance.
Please configure a URL for your GitLab instance by setting `external_url`
configuration in /etc/gitlab/gitlab.rb file.

Reconfigure gitlab services using below command,

gitlab-ctl reconfigure

Output:

root@vps:~#gitlab-ctl reconfigure
Starting Chef Infra Client, version 15.14.0
resolving cookbooks for run list: ["gitlab"]
Synchronizing Cookbooks:
  - gitlab (0.0.1)
  - package (0.1.0)
  - logrotate (0.1.0)
  - postgresql (0.1.0)
  - redis (0.1.0)
  - monitoring (0.1.0)
  - registry (0.1.0)
  - mattermost (0.1.0)
  - consul (0.1.0)
  - gitaly (0.1.0)
  - praefect (0.1.0)
  - gitlab-kas (0.1.0)
  - letsencrypt (0.1.0)

To start the Gitlab Services.

gitlab-ctl start

Output:

root@vps:~#gitlab-ctl start
ok: run: alertmanager: (pid 61628) 0s
ok: run: gitaly: (pid 61319) 25s
ok: run: gitlab-exporter: (pid 61284) 26s
ok: run: gitlab-workhorse: (pid 61261) 27s
ok: run: grafana: (pid 61368) 20s
ok: run: logrotate: (pid 59471) 404s
ok: run: nginx: (pid 59983) 218s
ok: run: node-exporter: (pid 61269) 27s
ok: run: postgres-exporter: (pid 61361) 21s
ok: run: postgresql: (pid 59709) 379s
ok: run: prometheus: (pid 61310) 25s
ok: run: puma: (pid 59903) 237s
ok: run: redis: (pid 59532) 397s
ok: run: redis-exporter: (pid 61286) 25s
ok: run: sidekiq: (pid 59922) 230s

To check the Status of Gitlab Services.

gitlab-ctl status

Output:

root@vps:~# gitlab-ctl status
down: alertmanager: 1s, normally up, want up; run: log: (pid 60138) 226s
run: gitaly: (pid 61319) 78s; run: log: (pid 59578) 439s
run: gitlab-exporter: (pid 61284) 79s; run: log: (pid 60057) 250s
run: gitlab-workhorse: (pid 61261) 80s; run: log: (pid 59959) 274s
run: grafana: (pid 61368) 73s; run: log: (pid 60761) 147s
run: logrotate: (pid 59471) 457s; run: log: (pid 59502) 454s
run: nginx: (pid 59983) 271s; run: log: (pid 59997) 268s
run: node-exporter: (pid 61269) 80s; run: log: (pid 60037) 260s
run: sidekiq: (pid 59922) 283s; run: log: (pid 59935) 280s

Now navigate to your browser to set the password default user is the root, http://IP_address

Output:

gitlab1

Done.


CrownCloud - Get a SSD powered KVM VPS at $4.5/month!
Use the code WELCOME for 10% off!

1 GB RAM / 25 GB SSD / 1 CPU Core / 1 TB Bandwidth per month

Available Locations: LAX | MIA | ATL | FRA | AMS