How to install Gitlab on Debian 12

To Install GitLab On Debian 12

Introduction

Gitlab is a service that provides remote access to Git repositories. In addition to hosting your code, the services provide additional features designed to help manage the software development lifecycle. These additional features include managing the sharing of code between different people, bug tracking, wiki space, and other tools for 'social coding'.

Procedure Steps

Step 1: Check the OS version by using the below command.

root@linuxhelp:~# cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL=https://bugs.debian.org/

Step 2: Update the system packages by using the below command.

root@linuxhelp:~# apt update -y
Get:1 http://security.debian.org/debian-security bookworm-security InRelease [48.0 kB]
Hit:2 http://deb.debian.org/debian bookworm InRelease
Get:3 http://deb.debian.org/debian bookworm-updates InRelease [52.1 kB]
Get:4 http://security.debian.org/debian-security bookworm-security/main Sources [79.4 kB]
Get:5 http://security.debian.org/debian-security bookworm-security/main amd64 Packages [137 kB]
Get:6 http://security.debian.org/debian-security bookworm-security/main Translation-en [81.4 kB]
Fetched 398 kB in 1s (688 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
16 packages can be upgraded. Run 'apt list --upgradable' to see them.

Step 3: Upgrade the system packages by using the below command.

root@linuxhelp:~# apt upgrade -y
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
  firefox-esr gir1.2-gst-plugins-bad-1.0 gstreamer1.0-plugins-bad libc-bin libc-dev-bin libc-devtools libc-l10n libc6 libc6-dev libgstreamer-plugins-bad1.0-0 libzbar0 locales xserver-common xserver-xephyr
  xserver-xorg-core xserver-xorg-legacy
16 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 88.9 MB of archives.
After this operation, 71.7 kB of additional disk space will be used.
Get:1 http://security.debian.org/debian-security bookworm-security/main amd64 libc-devtools amd64 2.36-9+deb12u4 [53.0 kB]
Get:2 http://security.debian.org/debian-security bookworm-security/main amd64 libc6-dev amd64 2.36-9+deb12u4 [1,897 kB]
Get:3 http://security.debian.org/debian-security bookworm-security/main amd64 libc-dev-bin amd64 2.36-9+deb12u4 [45.4 kB]
Setting up libc6-dev:amd64 (2.36-9+deb12u4) ...
Processing triggers for desktop-file-utils (0.26-1) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Processing triggers for gnome-menus (3.36.0-1.1) ...
Processing triggers for libc-bin (2.36-9+deb12u4) ...
Processing triggers for man-db (2.11.2-2) ...
Processing triggers for mailcap (3.70+nmu1) ...

Step 4: Install the dependencies by using the below command.

root@linuxhelp:~# apt-get install curl ca-certificates apt-transport-https gnupg2 -y
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
ca-certificates is already the newest version (20230311).
The following NEW packages will be installed:
  apt-transport-https curl gnupg2
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 786 kB of archives.
After this operation, 999 kB of additional disk space will be used.
Get:1 http://security.debian.org/debian-security bookworm-security/main amd64 curl amd64 7.88.1-10+deb12u5 [315 kB]
Get:2 http://deb.debian.org/debian bookworm/main amd64 apt-transport-https all 2.6.1 [25.2 kB]
Get:3 http://deb.debian.org/debian bookworm/main amd64 gnupg2 all 2.2.40-1.1 [445 kB]
Fetched 786 kB in 0s (2,021 kB/s)
Selecting previously unselected package apt-transport-https.
(Reading database ... 169305 files and directories currently installed.)
Preparing to unpack .../apt-transport-https_2.6.1_all.deb ...
Unpacking apt-transport-https (2.6.1) ...
Selecting previously unselected package curl.
Preparing to unpack .../curl_7.88.1-10+deb12u5_amd64.deb ...
Unpacking curl (7.88.1-10+deb12u5) ...
Selecting previously unselected package gnupg2.
Preparing to unpack .../gnupg2_2.2.40-1.1_all.deb ...
Unpacking gnupg2 (2.2.40-1.1) ...
Setting up gnupg2 (2.2.40-1.1) ...
Setting up apt-transport-https (2.6.1) ...
Setting up curl (7.88.1-10+deb12u5) ...
Processing triggers for man-db (2.11.2-2) ...

Step 5: Add gitlap apt repository by using the below command.

root@linuxhelp:~# curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | bash
Detected operating system as debian/bookworm.
Checking for curl...
Detected curl...
Checking for gpg...
Detected gpg...
Running apt-get update... done.
Installing debian-archive-keyring which is needed for installing
apt-transport-https on many Debian systems.
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 6: Install the GitLab by using the below command.

root@linuxhelp:~# apt-get install gitlab-ce -y
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
  gitlab-ce
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 1,101 MB of archives.
After this operation, 3,110 MB of additional disk space will be used.
Get:1 https://packages.gitlab.com/gitlab/gitlab-ce/debian bookworm/main amd64 gitlab-ce amd64 16.8.1-ce.0 [1,101 MB]
Fetched 1,101 MB in 1min 39s (11.1 MB/s)
Selecting previously unselected package gitlab-ce.
(Reading database ... 169323 files and directories currently installed.)
Preparing to unpack .../gitlab-ce_16.8.1-ce.0_amd64.deb ...
Unpacking gitlab-ce (16.8.1-ce.0) ...
Setting up gitlab-ce (16.8.1-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-8

Step 7: Make the configuration to include your own domain by using the below command.

root@linuxhelp:~# vim /etc/gitlab/gitlab.rb | grep mygitlab.com
external_url 'http://mygitlab.com'

Step 8: Make gitlab configuration apply by using the below command.

root@linuxhelp:~# gitlab-ctl reconfigure
[2024-02-06T09:00:40+05:30] INFO: Started Cinc Zero at chefzero://localhost:1 with repository at /opt/gitlab/embedded (One version per cookbook)
Cinc Client, version 17.10.0
Patents: https://www.chef.io/patents
Infra Phase starting
[2024-02-06T09:00:40+05:30] INFO: *** Cinc Client 17.10.0 ***
[2024-02-06T09:00:40+05:30] INFO: Platform: x86_64-linux
[2024-02-06T09:00:40+05:30] INFO: Cinc-client pid: 24187
[2024-02-06T09:00:42+05:30] INFO: Setting the run_list to ["recipe[gitlab]"] from CLI options

Notes:
Default admin account has been configured with following details:
Username: root
Password: You didn't opt-in to print initial root password to STDOUT.
Password stored to /etc/gitlab/initial_root_password. This file will be cleaned up in first reconfigure run after 24 hours.

NOTE: Because these credentials might be present in your log files in plain text, it is highly recommended to reset the password following https://docs.gitlab.com/ee/security/reset_user_password.html#reset-your-root-password.

gitlab Reconfigured!

Step 9: Make the hosts entry by using the below command.

root@linuxhelp:~# vim /etc/hosts
127.0.0.1	localhost
192.168.6.130   mygitlab.com  	linuxhelp.linuxhelp	linuxhelp

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

Step 10: Goto the browser and search the domain as shown in below image.

Step 11: Get the default gitlab admin password by using following command.

root@linuxhelp:~# 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: Qlfsvrr1i6ASQgNHqRyH+jRw6e7wOXIb3AGSjSgmQMs=

# NOTE: This file will be automatically deleted in the first reconfigure run after 24 hours.

Step 12: Login the gitlab using default admin password as shown in below image.

Conclusion:

We have reached the end of this article. In this guide, we have walked you through the steps required to install Gitlab on Debian 12. Your feedback is much

FAQ
Q
How do I create a branch in GitLab?
A
To create a branch in GitLab, click on the "Branches" tab in your project. Then, click on the "New branch" button and enter a name for your branch.
Q
How do I add code to a GitLab project?
A
You can add code to a GitLab project by pushing it to a remote repository. You can do this using a Git client such as Git or GitHub Desktop.
Q
How do I create a project in GitLab?
A
To create a project in GitLab, click on the "New project" button. You will then need to enter a name for your project and choose a visibility level.
Q
Is GitLab free to use?
A
GitLab offers a free plan with limited features. There are also paid plans with more features and functionality.
Q
What is GitLab?
A
GitLab is a web-based DevOps platform that combines Git repository management with various other features. It is an open-source platform that allows for collaboration on code, tracking issues, and deploying applications.