How to install Gitlab on Ubuntu 22.04

Endrit Qerreti

Endrit Qerreti

In this tutorial, you will learn how to install Gitlab on Ubuntu 22.04.

Gitlab is a DevOPS platform that allows you to work and collaborate with your team on your projects. Gitlab is just like Github, it is a code repository that you can use to host your code for free.

Installing Gitlab on Ubuntu 22.04 is quite simple, and in this tutorial we'll be installing Gitlab community edition via the official repository.

Step 1 - Update your Ubuntu Machine

Before installing Gitlab, it is necessary to update your ubuntu machine so that you don't have outdated packages that might cause issues.

sudo apt-get update

Step 2 - Install Gitlab Dependencies

Once you have updated your Ubuntu machine, now you need to install Gitlab dependencies.

To install Gitlab dependencies, you can do so by running the command below

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

Step 3 - Add Gitlab Repository

Now, you need to install Gitlab repository on your Ubuntu machine. To do this, Gitlab provides a shell script that will detect the linux distro that your machine is using, and based on the distro it will setup the right repository for your machine.

This is the repository from where Gitlab will be downloaded from.

Adding Gitlab repository on your machine, is easy, and it can be done in three easy steps.

1) Download Official Gitlab repository shell script

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

2) Make it executable

chmod +x script.deb.sh

3) Execute to Add Gitlab repository on your machine

sudo ./script.deb.sh

Step 4 - Install Gitlab

Now that Gitlab repository has been added and set up on your machine, you can now proceed to install Gitlab community.

sudo apt install gitlab-ce

Conclusion

In this tutorial, you learned how to install Gitlab on Ubuntu 22.04.