You are on page 1of 21

11/26/23, 11:46 AM How to Install GitLab on Debian 12 Step-by-Step

 Menu

How to Install GitLab on Debian 12 Step-by-Step


Last Updated: September 21, 2023 by Pradeep Kumar

···

In this post, we will show you how install GitLab CE (Community Edition) on Debian 12 (Bookworm)
system step-by-step.

GitLab is a powerful web-based platform for version control and DevOps collaboration. It allows
developers to manage and track their source code repositories, collaborate with team members, and
automate various DevOps processes.

Table of Contents
Prerequisites
1) Update the System
2) Install GitLab Dependencies
3) Install Gitlab on Debian 12
4) Configure Gitlab
5) Access Gitlab Web Interface
6) Change Root Password
7) Secure Gitlab using Let’s Encrypt SSL Certificate

Prerequisites
Before getting started, ensure that you have the following in place:

https://www.linuxtechi.com/how-to-install-gitlab-on-debian/ 1/21
11/26/23, 11:46 AM How to Install GitLab on Debian 12 Step-by-Step

···
An instance of Debian 12 with SSH access.
Minimum of 8 GB RAM
20GB of hard disk space
A valid domain name pointed to the IP address of the server.
User with sudo rights

Let’s get started with installing GitLab CE on Debian 12.

1) Update the System


To get started, access your Debian server using SSH as a sudo user and invoke the following
command to update the package lists on your system.

$ sudo apt update

2) Install GitLab Dependencies


The next step is to install dependencies that will be essential when installing GitLab. To do so, run
the command:

$ sudo apt install wget ca-certificates curl apt-transport-https gnupg2 -y 

https://www.linuxtechi.com/how-to-install-gitlab-on-debian/ 2/21
11/26/23, 11:46 AM How to Install GitLab on Debian 12 Step-by-Step

3) Install Gitlab on Debian 12


Once all the prerequisites have been installed, the next step is to install Gitlab. Thankfully, Gitlab
provides an automated script that handles the installation of Gitlab including adding the Gitlab
repository and importing the GPG key.

$ curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.de

Next, install the GitLab community edition on Debian 12 as shown.

$ sudo apt install gitlab-ce -y

https://www.linuxtechi.com/how-to-install-gitlab-on-debian/ 3/21
11/26/23, 11:46 AM How to Install GitLab on Debian 12 Step-by-Step

During the installation, you will see a notification that GitLab has not yet been configured as well as
not being able to detect a hostname for your instance. In addition, you will be required to configure a
URL for your instance by setting the `external_url` directive in the /etc/gitlab/gitlab.rb configuration
file.

We are going to do this in the next steps.

https://www.linuxtechi.com/how-to-install-gitlab-on-debian/ 4/21
11/26/23, 11:46 AM How to Install GitLab on Debian 12 Step-by-Step

We will go a step further and make the necessary configurations.

4) Configure Gitlab
To configure your GitLab installation, you need to edit the ‘github.rb’ file as indicated in the summary
output. Here we will use the vi editor to open the file.

$ sudo vi /etc/gitlab/gitlab.rb

Search and locate the ‘external_url‘ parameter. Update the field to correspond to your domain as
follows:

external_url ‘http://domain.com’

Using our test domain, this will be:

external_url ‘http://crazytechgeek.info’

Next, locate the letsencrypt[‘contact_emails’] field and update it to include an email address that
will be used to alert the user when the Let’s Encrypt SSL certificate nears its expiration date.

letsencrypt[‘contact_emails’] = [‘admin@linuxtechi.com’] 

https://www.linuxtechi.com/how-to-install-gitlab-on-debian/ 5/21
11/26/23, 11:46 AM How to Install GitLab on Debian 12 Step-by-Step

Finally, save the file and reconfigure the GitLab installation as shown.

$ sudo gitlab-ctl reconfigure

The reconfiguration takes a while – roughly 7 minutes. Once done, you should get the notification
‘GitLab Reconfigured!’.

5) Access Gitlab Web Interface


All the steps for installation a basic installation of GitLab are complete. The next step is to log into
the web interface using the root credentials.

NOTE: By default, Gitlab generates a root password and stores it in the


/etc/gitlab/initial_root_password file.

$ cat /etc/gitlab/initial_root_password

Next, access the web interface


https://www.linuxtechi.com/how-to-install-gitlab-on-debian/ 6/21
11/26/23, 11:46 AM How to Install GitLab on Debian 12 Step-by-Step

http://domain.com

Use `root` as the username and the password from the initiall_root_password file then click ‘Sign In’.

This ushers you to the dashboard below.

6) Change Root Password


Unlike previous Gitlab releases that allowed you to reset the root password after providing the
initial password for the first time, the current version requires you to manually set a new password
from the ‘Admin’ settings.

So, click on the ‘Admin’ icon shown and select ‘Edit’ profile.
https://www.linuxtechi.com/how-to-install-gitlab-on-debian/ 7/21
11/26/23, 11:46 AM How to Install GitLab on Debian 12 Step-by-Step

Next, navigate and select ‘Password’ and create a new password. Then click ‘Save password’ to
save the new password that you have just created.

7) Secure Gitlab using Let’s Encrypt SSL Certificate


Another step you should consider is encrypting your GitLab instance with an SSL certificate to
encrypt traffic transmitted back and forth. You can easily achieve this using the Let’s Encrypt SSL
certificate. 

https://www.linuxtechi.com/how-to-install-gitlab-on-debian/ 8/21
11/26/23, 11:46 AM How to Install GitLab on Debian 12 Step-by-Step

GitLab configuration supports Let’s Encrypt and, in this step, we will configure our Gitlab instance to
use Let’s Encrypt SSL for secure connections.

Now back to the gitlab.rb file

$ sudo vi /etc/gitlab/gitlab.rb

Edit the following parameters as shown.

letsencrypt['enable'] = true
letsencrypt['auto_renew'] = true

The first line allows Let’s Encrypt to be configured and the second line sets the renewal of the
certificate to be automatic.

Along with that, you can define the auto-renewal hour and day of the month as follows:

letsencrypt['auto_renew_hour'] = 5
letsencrypt['auto_renew_day_of_month'] = "*/6"

Also, set the URL to use HTTPS protocol instead of HTTP.

external_url 'https://crazytechgeek.info'

Save the changes and exit the config file. To effect the changes, once again, run the command
below.

$ sudo gitlab-ctl reconfigure

To verify that everything went according to plan, invoke the command:

$ sudo gitlab-rake gitlab:check

https://www.linuxtechi.com/how-to-install-gitlab-on-debian/ 9/21
11/26/23, 11:46 AM How to Install GitLab on Debian 12 Step-by-Step

Now Reload the browser. This time around, you will notice that the URL to your server’s instance is
now secured using Let’s Encrypt SSL certificates.

This wraps up our guide for today. In this guide, we showed you how to install and configure GitLab
on Debian 12 step-by-step.

I hope you have found it informative and useful. Kindly do post your queries and feedback in below
comments section.

Also Read: How to Install NFS Server on Debian 12 Step-by-Step

Share Now!

Leave a Comment 

https://www.linuxtechi.com/how-to-install-gitlab-on-debian/ 10/21
11/26/23, 11:46 AM How to Install GitLab on Debian 12 Step-by-Step

Name *

Email *

Post Comment

Search … 

https://www.linuxtechi.com/how-to-install-gitlab-on-debian/ 11/21
11/26/23, 11:46 AM How to Install GitLab on Debian 12 Step-by-Step

Recent Posts

How to Install Docker on Linux Mint 21 Step-by-Step

How to Install MySQL on Ubuntu 22.04 Step-by-Step

How to Install VirtualBox on Linux Mint 21 Step-by-Step

How to Install VirtualBox Guest Additions on Linux Mint 21 

https://www.linuxtechi.com/how-to-install-gitlab-on-debian/ 12/21
11/26/23, 11:46 AM How to Install GitLab on Debian 12 Step-by-Step

How to Register Existing Kubernetes Cluster in Rancher

How to Install and Configure VNC Server on RHEL 9

How to Install LMDE 6 (Linux Mint Debian Edition)

How to Install Rancher on Rocky Linux 9 / AlmaLinux 9

How to Install VirtualBox Guest Additions on RHEL 9

How to Install Kubernetes on Rocky Linux 9 | AlmaLinux 9

dyson_ro

Retușează sau transformă cu tehnologia


Dyson.

Produsele de îngrijire a părului


Dyson

AFLAȚI MAI MULTE

https://www.linuxtechi.com/how-to-install-gitlab-on-debian/ 13/21
11/26/23, 11:46 AM How to Install GitLab on Debian 12 Step-by-Step

https://www.linuxtechi.com/how-to-install-gitlab-on-debian/ 14/21
11/26/23, 11:46 AM How to Install GitLab on Debian 12 Step-by-Step

https://www.linuxtechi.com/how-to-install-gitlab-on-debian/ 15/21
11/26/23, 11:46 AM How to Install GitLab on Debian 12 Step-by-Step

https://www.linuxtechi.com/how-to-install-gitlab-on-debian/ 16/21
11/26/23, 11:46 AM How to Install GitLab on Debian 12 Step-by-Step

https://www.linuxtechi.com/how-to-install-gitlab-on-debian/ 17/21
11/26/23, 11:46 AM How to Install GitLab on Debian 12 Step-by-Step

https://www.linuxtechi.com/how-to-install-gitlab-on-debian/ 18/21
11/26/23, 11:46 AM How to Install GitLab on Debian 12 Step-by-Step

https://www.linuxtechi.com/how-to-install-gitlab-on-debian/ 19/21
11/26/23, 11:46 AM How to Install GitLab on Debian 12 Step-by-Step

https://www.linuxtechi.com/how-to-install-gitlab-on-debian/ 20/21
11/26/23, 11:46 AM How to Install GitLab on Debian 12 Step-by-Step

HTML Sitemap Privacy Policy Contact Us About Us Write For LinuxTechi

Follow Us

© 2023 LinuxTechi

https://www.linuxtechi.com/how-to-install-gitlab-on-debian/ 21/21

You might also like