How to install gitlab-ce on Ubuntu 22.04
- 00:45 lsb_release -a
- 01:08 apt update
- 01:46 apt install ca-certificates curl openssh-server postfix tzdata perl -y
- 02:48 cd /tmp/
- 02:59 curl -LO https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh
- 03:17 less /tmp/script.deb.sh
- 03:44 bash /tmp/script.deb.sh
- 04:12 apt install gitlab-ce -y
- 04:25 kill -9 5438
- 04:27 apt install gitlab-ce -y
- 06:09 ufw status
- 06:29 vim /etc/gitlab/gitlab.rb
- 07:35 gitlab-ctl reconfigure
- 10:00 cat /etc/gitlab/initial_root_password
To Install Gitlab-ce On Ubuntu 22.04
Introduction
GitLab is a web-based repository that provides free open and private repositories, issue-following capabilities, and wikis. It is a complete DevOps platform that enables professionals to perform all the tasks in a project—from project planning and source code management to monitoring and security.
Procedure Steps
Step 1: At first check the OS version by using the below command
root@linuxhelp:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.3 LTS
Release: 22.04
Codename: jammy
Step 2: Update the repository by using apt update by using the below command
root@linuxhelp:~# apt update
Hit:1 http://in.archive.ubuntu.com/ubuntu jammy InRelease
Get:2 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB]
Get:3 http://in.archive.ubuntu.com/ubuntu jammy-updates InRelease [119 kB]
Get:4 http://in.archive.ubuntu.com/ubuntu jammy-backports InRelease [109 kB]
Get:5 http://security.ubuntu.com/ubuntu jammy-security/main amd64 Packages [1,245 kB]
Get:6 http://in.archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages [1,461 kB]
Get:7 http://security.ubuntu.com/ubuntu jammy-security/main i386 Packages [420 kB]
Fetched 12.0 MB in 8s (1,544 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
251 packages can be upgraded. Run 'apt list --upgradable' to see them.
Step 3: Install the dependencies by using the below command
root@linuxhelp:~# apt install ca-certificates curl openssh-server postfix tzdata perl -y
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
ca-certificates is already the newest version (20230311ubuntu0.22.04.1).
ca-certificates set to manually installed.
The following packages were automatically installed and are no longer required:
libflashrom1 libftdi1-2 libllvm13
Use 'apt autoremove' to remove them.
Setting up perl (5.34.0-3ubuntu1.3) ...
Processing triggers for rsyslog (8.2112.0-2ubuntu2.2) ...
Processing triggers for ufw (0.36.1-4ubuntu0.1) ...
Processing triggers for man-db (2.10.2-1) ...
Processing triggers for libc-bin (2.35-0ubuntu3.1) ...
Step 4: Now move to the /tmp directory by using the below command
root@linuxhelp:~# cd /tmp/
root@linuxhelp:/tmp#
Step 5: Download the Installation script by using the below command
root@linuxhelp:/tmp# curl -LO https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 6865 100 6865 0 0 11803 0 --:--:-- --:--:-- --:--:-- 11795
Step 6: View the script by using less command
root@linuxhelp:/tmp# less /tmp/script.deb.sh
Step 7: Run the script to setup the repository by using the below command
root@linuxhelp:/tmp# bash /tmp/script.deb.sh
Detected operating system as Ubuntu/jammy.
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.
Step 8: Now the repository has been configured to use the GitLab maintained repositories. Install gitlab by using the below command.
root@linuxhelp:/tmp# apt install gitlab-ce -y
Waiting for cache lock: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 5438 (unattended-upgr)
Waiting for cache lock: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 5438 (unattended-upgr)
Waiting for cache lock: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 5438 (unattended-upgr)
^Citing for cache lock: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 5438 (unattended-upgr)... 3s
Step 9: The above error is due to another process is running, So I kill that process by using the below command
root@linuxhelp:/tmp# kill -9 5438
Step 10: Now again run the installation command by using the below command
root@linuxhelp:/tmp# apt install gitlab-ce -y
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
libflashrom1 libftdi1-2 libllvm13
Use 'apt autoremove' to remove them.
The following NEW packages will be installed:
gitlab-ce
0 upgraded, 1 newly installed, 0 to remove and 241 not upgraded.
Need to get 1,128 MB of archives.
After this operation, 3,175 MB of additional disk space will be used.
Get:1 https://packages.gitlab.com/gitlab/gitlab-ce/ubuntu jammy/main amd64 gitlab-ce amd64 16.9.2-ce.0 [1,128 MB]
Fetched 1,128 MB in 46s (24.3 MB/s)
Selecting previously unselected package gitlab-ce.
(Reading database ... 202530 files and directories currently installed.)
Preparing to unpack .../gitlab-ce_16.9.2-ce.0_amd64.deb ...
Unpacking gitlab-ce (16.9.2-ce.0) ...
Setting up gitlab-ce (16.9.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.
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=16-9
Step 11: Gitlab installation has been completed, Now check the status of the default Ubuntu firewall by using the below command
root@linuxhelp:/tmp# ufw status
Status: inactive
Step 12: Configure your domain for gitlab, for that edit the gitlab.rb file and change the external url and comment the SSL lines by using the below command
root@linuxhelp:/tmp# vim /etc/gitlab/gitlab.rb
Step 13: Run the gitlab reconfigure command to apply the changes by using the below command
root@linuxhelp:/tmp# gitlab-ctl reconfigure
[2024-03-13T08:09:52+05:30] INFO: Started Cinc Zero at chefzero://localhost:1 with repository at /opt/gitlab/embedded (One version per cookbook)
Cinc Client, version 18.3.0
Patents: https://www.chef.io/patents
Infra Phase starting
[2024-03-13T08:09:52+05:30] INFO: *** Cinc Client 18.3.0 ***
[2024-03-13T08:09:52+05:30] INFO: Platform: x86_64-linux
[2024-03-13T08:09:52+05:30] INFO: Cinc-client pid: 20600
[2024-03-13T08:09:56+05:30] INFO: Setting the run_list to ["recipe[gitlab]"] from CLI options
[2024-03-13T08:09:56+05:30] INFO: Run List is [recipe[gitlab]]
[2024-03-13T08:09:56+05:30] INFO: Run List expands to [gitlab]
[2024-03-13T08:09:56+05:30] INFO: Starting Cinc Client Run for linuxhelp
[2024-03-13T08:09:56+05:30] INFO: Running start handlers
[2024-03-13T08:09:56+05:30] INFO: Start handlers complete.
Resolving cookbooks for run list: ["gitlab"]
[2024-03-13T08:09:59+05:30] INFO: Loading 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, gitlab-pages@0.1.0, letsencrypt@0.1.0, nginx@0.1.0, runit@5.1.7, acme@4.1.6, crond@0.1.0]
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)
- praefect (0.1.0)
- gitaly (0.1.0)
- gitlab-kas (0.1.0)
- gitlab-pages (0.1.0)
- letsencrypt (0.1.0)
- runit (5.1.7)
- acme (4.1.6)
- nginx (0.1.0)
- crond (0.1.0)
Installing cookbook gem dependencies:
Compiling cookbooks...
/opt/gitlab/embedded/cookbooks/cache/cookbooks/package/libraries/helpers/selinux_distro_helper.rb:2: warning: already initialized constant SELinuxDistroHelper::REDHAT_RELEASE_FILE
/opt/gitlab/embedded/cookbooks/package/libraries/helpers/selinux_distro_helper.rb:2: warning: previous definition of REDHAT_RELEASE_FILE was here
/opt/gitlab/embedded/cookbooks/cache/cookbooks/package/libraries/helpers/selinux_distro_helper.rb:3: warning: already initialized constant SELinuxDistroHelper::OS_RELEASE_FILE
/opt/gitlab/embedded/cookbooks/package/libraries/helpers/selinux_distro_helper.rb:3: warning: previous definition of OS_RELEASE_FILE was here
/opt/gitlab/embedded/cookbooks/cache/cookbooks/package/libraries/helpers/secrets_helper.rb:4: warning: already initialized constant SecretsHelper::SECRETS_FILE
/opt/gitlab/embedded/cookbooks/package/libraries/helpers/secrets_helper.rb:4: warning: previous definition of SECRETS_FILE was here
:10:40+05:30] INFO: Cinc Client Run complete in 44.065879472 seconds
Running handlers:
[2024-03-13T08:10:40+05:30] INFO: Running report handlers
Running handlers complete
[2024-03-13T08:10:41+05:30] INFO: Report handlers complete
Infra Phase complete, 0/816 resources updated in 48 seconds
Warnings:
Environment variable LANG specifies a non-UTF-8 locale. GitLab requires UTF-8 encoding to function properly. Please check your locale settings.
gitlab Reconfigured!
Step 14: Now go to the Browser and search with the URL as shown in the below image

Step 15: Click Advanced option as shown in the below image

Step 16: Then click Accept Risk and continue as shown in the below image

Step 17: Now the Gitlab login page will appear as shown in the below image

Step 18: To get the initial password go to the browser and open the below file as shown in the below image
root@linuxhelp:/tmp# cat /etc/gitlab/initial_root_password
# WARNING: This value is valid only in the following conditions
# 1. If provided manually (either via `GITLAB_ROOT_PASSWORD` environment variable or via `gitlab_rails['initial_root_password']` setting in `gitlab.rb`, it was provided before database was seeded for the first time (usually, the first reconfigure run).
# 2. Password hasn't been changed manually, either via UI or via command line.
#
# If the password shown here doesn't work, you must reset the admin password following https://docs.gitlab.com/ee/security/reset_user_password.html#reset-your-root-password.
Password: ukpULJxbnnTQOdjgrk4/axz5DXL7ag5nwtx6YXB+hec=
# NOTE: This file will be automatically deleted in the first reconfigure run after 24 hours.
Step 19: Copy the password and go to the browser enter username as root and use the initial password. You will get the gitlab dashboard as shown in the below image

Step 20: If you want to change the password. Click the profile on the left side bar as shown in the below image

Step 21: Then click Edit profile as shown in the below image

Step 22: Now you will see the password session on the left side tool bar as shown in the below image

Step 23: Then enter your current password and new password to change the password as shown in the below image

Conclusion:
We have reached the end of this article. In this guide, we have walked you through the steps required to installation of Gitlab-ce on Ubuntu 22.04. Your feedback is much welcome.
Comments ( 0 )
No comments available