In this week’s feature highlight, we look at How to Install Gitlab On Debian 12
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 the system.
apt update apt upgrade
Install required dependencies,
apt-get install curl ca-certificates apt-transport-https gnupg2 -y
Add Gitlab Repository using below command,
curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | bash
At the time of making this guide, the GitLab package is not available for Debian 11. You will need to edit the GitLab source file and replace the Debian 11 (Bullseye) code name with Debian 10 (Buster),
Find the following lines,
deb https://packages.gitlab.com/gitlab/gitlab-ce/debian/ booksworm main deb-src https://packages.gitlab.com/gitlab/gitlab-ce/debian/ booksworm main
Replaced them with the following lines.
deb https://packages.gitlab.com/gitlab/gitlab-ce/debian/ bullseye main deb-src https://packages.gitlab.com/gitlab/gitlab-ce/debian/ bullseye main
Save and close the file and update the repository using the below command,
Install GitLab CE
apt-get install gitlab-ce -y
root@server:~# 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,323 MB of archives. After this operation, 3,164 MB of additional disk space will be used. Get:1 https://packages.gitlab.com/gitlab/gitlab-ce/debian bullseye/main amd64 gitlab-ce amd64 16.0.4-ce. 0 [1,323 MB] Fetched 1,323 MB in 43s (30.7 MB/s) Selecting previously unselected package gitlab-ce. (Reading database ... 28668 files and directories currently installed.) Preparing to unpack .../gitlab-ce_16.0.4-ce.0_amd64.deb ... Unpacking gitlab-ce (16.0.4-ce.0) ... Setting up gitlab-ce (16.0.4-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-0
Once the installation is complete, we will configure the GitLab to our requirements. Below are the edits that can be done,
Replace the following line with your domain name,
Replace/Edit the following lines to enable the Let’s Encrypt SSL,
# Enable the Let's encrypt SSL letsencrypt['enable'] = true # This is optional to get SSL related alerts letsencrypt['contact_emails'] = ['email@example.com'] # This example renews every 1st day at 01:00 AM letsencrypt['auto_renew_hour'] = "1" letsencrypt['auto_renew_minute'] = "0" letsencrypt['auto_renew_day_of_month'] = "*/1"
Save and close the file.
Let us update the repository now with the below command,
Recipe: registry::enable * runit_service[registry] action restart (up to date) Recipe: nginx::enable * execute[reload nginx] action run - execute gitlab-ctl hup nginx Recipe: letsencrypt::enable * ruby_block[display_le_message] action run - execute the ruby block display_le_message Recipe: monitoring::grafana * runit_service[grafana] action restart (up to date) Running handlers: Running handlers complete Chef Infra Client finished, 26/861 resources updated in 02 minutes 08 seconds Warnings: Let's Encrypt is enabled, but external_url is using http gitlab Reconfigured!
Retrieve the GitLab password using following command,
root@server:~# 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: sfC7QoruHZwNUt/WCQtyDa0uFldUUV+vdGBlitq/Bww= # NOTE: This file will be automatically deleted in the first reconfigure run after 24 hours.
Open a browser and type the following address and You will be redirected to the GitLab login page,
Replace Your_Domain_Name with Actual Domain name