How to Install GitLab Open Source Server on Debian 11. This article will introduce what git and GitLab is with GitLab features (pros) and step by step instructions how to Install it on Debian 11.
What is Git?
First thing to know is what is git? Git is a control system tool that is used to track changes in computer files. Its main function is to manage any changes made in one or more projects over a given period of time.
What is GitLab?
GitLab is a free, open source and centralized code repository platform developed and managed by GitLab Inc. It is used for the software development process, issue tracking, and CI/CD by DevOps tools. GitLab server issues an open source license that helps DevOps in issue tracking on CI/CD pipeline. Gitlab has become one of the popular and trusted software development platforms that comprise the ability to write code, verify, upload in the cloud, monitor performance by following best security practices. It will allow you to create, store, deploy and collaborate on all web based projects from the central location. Many companies including, IBM, Sony, Cisco, Juniper, Oracle use this solution.
Gitlab’s public repository is mostly used for issue tracking and documentation.
GitLab Features (Pros)
Projects and Compliance Management.
Audit Events and Reports.
Automates the entire DevOps lifecycle to achieve the best results.
Servers monitoring and applications.
Static web push.
Authentication and Authorization (granular restrictions and permissions using Kerberos server for authentication).
Integration of Kubernetes
Automation of CI/CD process.
Issue Tracking. Another great solution for issue tracking is Bugzilla.
API / Integrations
Wiki based project documentation.
Infrastructure as Code (IaC) Security Scanning.
Next in this post we will show you the necessary steps to install GitLab self hosted server on Debian 11.
Add the GitLab CE Repository
By default, the GitLab package is not included in the Debian 11 default repository. So you will need to add the GitLab official repository to your system.
First let’s install the required packages with the following command:
apt-get install gnupg2 curl ca-certificates -y
Next we will download and execute the following script to add the GitLab repository to APT.
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | bash
Once the repository is added we can verify it using the following command:
We get the following output:
# this file was generated by packages.gitlab.com for # the repository at https://packages.gitlab.com/gitlab/gitlab-ce deb https://packages.gitlab.com/gitlab/gitlab-ce/debian/ bullseye main deb-src https://packages.gitlab.com/gitlab/gitlab-ce/debian/ bullseye main
Install GitLab Open Source Server on Debian 11
Please follow the below steps to Install GitLab Open Source Server on Debian 11.
Install GitLab on Debian 11
After installing the GitLab repository, you can update it with the following command:
apt-get update -y
Once the repository is updated, install the GitLab community edition by running the following command:
apt-get install gitlab-ce -y
Upon installing GitLab, you will get the following result:
*. *. *** *** ***** ***** .****** ******* ******** ******** ,,,,,,,,,***********,,,,,,,,, ,,,,,,,,,,,*********,,,,,,,,,,, .,,,,,,,,,,,*******,,,,,,,,,,,, ,,,,,,,,,*****,,,,,,,,,. ,,,,,,,****,,,,,, .,,,***,,,, ,*,. _______ __ __ __ / ____(_) /_/ / ____ _/ /_ / / __/ / __/ / / __ `/ __ \ / /_/ / / /_/ /___/ /_/ / /_/ / \____/_/\__/_____/\__,_/_.___/ 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-8
Now, you will need to edit the gitlab.rb configuration file and define your domain name.
Change the following line with your domain name:
Save and close the file, then reconfigure the GitLab by running the following command:
This will configure the GitLab and set the root password to access the GitLab web interface:
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!
Next is to retrieve the root password using the following command:
You should see your root password in the following output:
# 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: 8w0/EhrslRKpLlypCtF48dBc/aJHsRmjOMixP112I4k= # NOTE: This file will be automatically deleted in the first reconfigure run after 24 hours.
To check the status of the GitLab, run the following command:
You will get the following output:
run: gitaly: (pid 14659) 127s; run: log: (pid 13875) 255s run: gitlab-exporter: (pid 14522) 150s; run: log: (pid 13856) 255s run: gitlab-kas: (pid 14499) 151s; run: log: (pid 13850) 255s run: gitlab-workhorse: (pid 14507) 151s; run: log: (pid 13852) 255s run: grafana: (pid 14601) 137s; run: log: (pid 13956) 253s run: logrotate: (pid 13878) 255s; run: log: (pid 13858) 255s run: nginx: (pid 13868) 255s; run: log: (pid 13867) 255s run: node-exporter: (pid 14513) 151s; run: log: (pid 13869) 255s run: postgres-exporter: (pid 14595) 137s; run: log: (pid 13871) 255s run: postgresql: (pid 13880) 255s; run: log: (pid 13879) 255s run: prometheus: (pid 14534) 149s; run: log: (pid 13861) 255s run: puma: (pid 13874) 255s; run: log: (pid 13873) 255s run: redis: (pid 13882) 256s; run: log: (pid 13877) 256s run: redis-exporter: (pid 14524) 151s; run: log: (pid 13859) 256s run: sidekiq: (pid 14951) 2s; run: log: (pid 13863) 256s
To stop the GitLab, run the following command:
To start the GitLab, run the following command:
Access GitLab Web UI
At this point of our step by step guide how to Install GitLab Open Source Server on Debian 11, the GitLab is installed and configured. Now, you can access the GitLab web interface using the URL http://gitlab.example.com. You will be redirected to the GitLab login page:
Provide your root username, password and click on the Sign in button. You should see the GitLab web interface on the following page:
Configure GitLab Backup
It is a good idea for you to create a backup copy of your GitLab instance. This will help you to recover GitLab in the event of system failure. You can use the gitlab-rake utility to create a backup:
You will get the following output:
2022-03-10 07:21:48 +0000 -- done 2022-03-10 07:21:48 +0000 -- Dumping uploads ... 2022-03-10 07:21:48 +0000 -- done 2022-03-10 07:21:48 +0000 -- Dumping builds ... 2022-03-10 07:21:48 +0000 -- done 2022-03-10 07:21:48 +0000 -- Dumping artifacts ... 2022-03-10 07:21:48 +0000 -- done 2022-03-10 07:21:48 +0000 -- Dumping pages ... 2022-03-10 07:21:48 +0000 -- done 2022-03-10 07:21:48 +0000 -- Dumping lfs objects ... 2022-03-10 07:21:48 +0000 -- done 2022-03-10 07:21:48 +0000 -- Dumping container registry images ... 2022-03-10 07:21:48 +0000 -- [DISABLED] Creating backup archive: 1642576908_2022_01_19_14.6.3_gitlab_backup.tar ... done Uploading backup archive to remote storage ... skipped Deleting tmp directories ... done
By default, GitLab backup is stored at /var/opt/gitlab/backups. You can change the backup path by editing the settings in the GitLab configuration file at /etc/gitlab/gitlab.rb.
The generated backup can be verified by using the following command:
This will give you the following result:
Reset GitLab Root Password
If you forget the GitLab administrator password then you can reset it easily using the following command:
You will be asked to set your new password as shown below:
Enter username: root Enter password: Confirm password: Password successfully updated for user with username root.
You have successfully installed GitLab Open Source Server on Debian 11.
How to Install GitLab Open Source Server on Debian 11 Conclusion
In this post, we have introduced what GitLab is with its features and explained how to install GitLab Open Source Server on Debian 11. You can now implement GitLab in your organization to improve performance and gain the best results through software development.