Installing Gitlab on Ubuntu 21.04

Hello,
In this week’s feature highlight, we look at How to Install Gitlab on Ubuntu 21.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 the following command,

wget --content-disposition https://packages.gitlab.com/gitlab/gitlab-ce/packages/ubuntu/bionic/gitlab-ce_14.3.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.3.2-ce.0_amd64.deb/download.deb
--2021-10-12 17:38:52--  https://packages.gitlab.com/gitlab/gitlab-ce/packages/ubuntu/bionic/gitlab-ce_14.3.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/113636.deb?t=1634060632_3852a301f49405ca6609e591b28b2f9a3768e7b1 [following]
--2021-10-12 17:38:52--  https://d20rj4el6vkp4c.cloudfront.net/7/8/ubuntu/package_files/113636.deb?t=1634060632_3852a301f49405ca6609e591b28b2f9a3768e7b1
Resolving d20rj4el6vkp4c.cloudfront.net (d20rj4el6vkp4c.cloudfront.net)... 52.222.190.154, 52.222.190.6, 52.222.190.213, ...
Connecting to d20rj4el6vkp4c.cloudfront.net (d20rj4el6vkp4c.cloudfront.net)|52.222.190.154|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 943821740 (900M) [application/x-debian-package]
Saving to: ‘gitlab-ce_14.3.2-ce.0_amd64.deb’

gitlab-ce_14.3.2-ce.0_amd64.deb 100%[======================================================>] 900.10M  50.1MB/s    in 18s     

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

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

Output:

root@vps:~# dpkg -i gitlab-ce_14.3.2-ce.0_amd64.deb 
Selecting previously unselected package gitlab-ce.
(Reading database ... 114495 files and directories currently installed.)
Preparing to unpack gitlab-ce_14.3.2-ce.0_amd64.deb ...
Unpacking gitlab-ce (14.3.2-ce.0) ...
Setting up gitlab-ce (14.3.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.17.4
  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)
    - gitaly (0.1.0)
    - consul (0.1.0)
    - gitlab-kas (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 a root, http://IP_address

Output:

gitlab1

Done.

(Visited 812 times, 1 visits today)