How to install Gitlab on Debian 12

Endrit Qerreti

Endrit Qerreti

Gitlab is one of the most popular services when it comes to code hosting. Gitlab is easily self hosted, meaning you can easily spin up a server with Gitlab on it and host your code.

Creating a Gitlab server is very easy, and all you have to do is install Gitlab on your server.

Self hosting Gitlab is very useful in cases when you want to have the total control of the code hosted.

Futhermore Gitlab comes in two editions, Enterprise and Community. Enterprise is paid version, and community version is free.

In this tutorial, you will learn how to install Gitlab on Debian 12.

Step 1 - Update your Debian machine

Make sure your Debian 12 machine, is up to date before installing Gitlab.

Run the command below to update your debian 12 machine.

sudo apt update

Step 2 - Install Gitlab Dependencies

In order to be able to install Gitlab without having issues, you must first install the required dependencies by running the command below

sudo apt-get install -y curl openssh-server ca-certificates perl

Step 3 - Add Gitlab Repository

To add Gitlab repository on your Debian 12 machine, is very easy. First you need to download the setup script, and then run it on your machine.

1) Download Gitlab repository setup file

curl -O https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh

2) Make script.deb.sh executable

To make the setup file executable, simply run the command below

chmod +x script.deb.sh

3) Finally run the setup file to add Gitlab repository

sudo ./script.deb.sh

Step 4 - Install Gitlab

Now you should be able to install Gitlab on your Debian 12 machine. To Install Gitlab community edition, run the command below

sudo apt install gitlab-ce

Conclusion

By now you should know how to install Gitlab on Debian 12.

In this tutorial, we used the official script provided by Gitlab to setup the Gitlab repository on our Debian 12 machine.

Gitlab supports multiple Linux distros, and it can be installed on any linux distro easily by using the official script to setup Gitlab repository.