How to Install Gitlab on Ubuntu 22 04

Hello,

In this week’s feature highlight, we look at How to Install Gitlab on Ubuntu 22 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

First, update your existing list of packages

apt update

apt upgrade -y

Install required 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 the Gitlab package using the 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@crown:~# wget --content-disposition https://packages.gitlab.com/gitlab/gitlab-ce/packages/ubuntu/bionic/gitlab-ce_14.1.2-ce.0_amd64.deb/download.deb
--2022-03-16 20:29:49--  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:1a7b, ...
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=1647462889_dfa2d924370e258ffb8d48079c1fd435029de6b7 [following]
--2022-03-16 20:29:49--  https://d20rj4el6vkp4c.cloudfront.net/7/8/ubuntu/package_files/110770.deb?t=1647462889_dfa2d924370e258ffb8d48079c1fd435029de6b7

Install the downloaded .deb the package on Ubuntu 22.04 using the below command

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

Output:

root@crown:~#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 the below command

gitlab-ctl reconfigure

Output:

root@crown:~#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)

Start the Gitlab Services

gitlab-ctl start

Output:

root@crown:~#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

Check the status of Gitlab Services

gitlab-ctl status

Output:

root@crown:~# 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 new password http://IP_address

Replace IP_address with you actual IP Address of the server.

Default user is root and the Password that was just set,

Output:

gitlab1

Reset Password for User

Example:

In case you’ve forgotten the password to any of your users, you can use the below Rake task to reset it.

gitlab-rake "gitlab:password:reset"

Example:

sudo gitlab-rake 'gitlab:password:reset[root]'
(Visited 22 times, 1 visits today)

Leave a Reply

Your email address will not be published. Required fields are marked *