How to Install Gitlab on Ubuntu 23.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/jammy/gitlab-ce_16.2.8-ce.0_amd64.deb/download.deb

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

dpkg -i gitlab-ce_16.2.8-ce.0_amd64.deb

Output:

root@ubuntu:~# dpkg -i gitlab-ce_16.2.8-ce.0_amd64.deb
Selecting previously unselected package gitlab-ce.
(Reading database ... 81644 files and directories currently installed.)
Preparing to unpack gitlab-ce_16.2.8-ce.0_amd64.deb ...
Unpacking gitlab-ce (16.2.8-ce.0) ...
Setting up gitlab-ce (16.2.8-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.
Then, you can start your GitLab instance by running the following command:
  sudo gitlab-ctl reconfigure

For a comprehensive list of configuration options please see the Omnibus GitLab readme
https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md

Help us improve the installation experience, let us know how we did with a 1 minute survey:
https://gitlab.fra1.qualtrics.com/jfe/form/SV_6kVqZANThUQ1bZb?installation=omnibus&release=14-1

Reconfigure gitlab services using below command,

gitlab-ctl reconfigure

Output:

root@crown:~# gitlab-ctl reconfigure
Starting Chef Infra Client, version 16.2.8
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@ubuntu:~# gitlab-ctl start
ok: run: alertmanager: (pid 17474) 0s
ok: run: gitaly: (pid 15320) 222s
ok: run: gitlab-exporter: (pid 15282) 223s
ok: run: gitlab-workhorse: (pid 15253) 225s
ok: run: grafana: (pid 15512) 212s
ok: run: logrotate: (pid 12901) 605s
ok: run: nginx: (pid 13388) 435s
ok: run: node-exporter: (pid 15268) 224s
ok: run: postgres-exporter: (pid 15505) 212s
ok: run: postgresql: (pid 13118) 580s
ok: run: prometheus: (pid 15295) 223s
ok: run: puma: (pid 13310) 453s
ok: run: redis: (pid 12938) 598s
ok: run: redis-exporter: (pid 15284) 223s
ok: run: sidekiq: (pid 13326) 447s

To check the Status of Gitlab Services.

gitlab-ctl status

Output:

root@ubuntu:~# gitlab-ctl status
down: alertmanager: 0s, normally up, want up; run: log: (pid 13534) 467s
run: gitaly: (pid 15320) 291s; run: log: (pid 12991) 657s
run: gitlab-exporter: (pid 15282) 292s; run: log: (pid 13453) 491s
run: gitlab-workhorse: (pid 15253) 294s; run: log: (pid 13357) 509s
run: grafana: (pid 15512) 281s; run: log: (pid 14666) 355s
run: logrotate: (pid 12901) 674s; run: log: (pid 12909) 673s
run: nginx: (pid 13388) 504s; run: log: (pid 13398) 503s
run: node-exporter: (pid 15268) 293s; run: log: (pid 13439) 495s
run: postgres-exporter: (pid 15505) 281s; run: log: (pid 13669) 452s
run: postgresql: (pid 13118) 649s; run: log: (pid 13132) 646s
run: prometheus: (pid 15295) 292s; run: log: (pid 13498) 474s
run: puma: (pid 13310) 522s; run: log: (pid 13317) 521s
run: redis: (pid 12938) 667s; run: log: (pid 12949) 664s
run: redis-exporter: (pid 15284) 292s; run: log: (pid 13478) 483s
run: sidekiq: (pid 13326) 516s; run: log: (pid 13336) 515s

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:

Incase you've forgot the password to any of your user, you can use the below Rake task to reset it.

gitlab-rake "gitlab:password:reset"

Example:

sudo gitlab-rake 'gitlab:password:reset[root]'