Categories: Ubuntu

Install GitLab on Ubuntu 22.04

GitLab is a web-based Git repository that acts as a version control system. A Version Control System (VCS) software tracks and maintain the source code changes in a collaborative environment. Like GitHub and Bitbucket, GitLab also allows you to access the Git repositories remotely.

GitLab can be used to share the code and necessities of a program throughout the development lifecycle of that program. One of the primary advantages of GitLab is that you can manage the Git repositories as per your requirement such as keeping the information public/private.

This article provides a step-by-step installation of GitLab on Ubuntu 22.04. Additionally, you will also learn to configure GitLab on Ubuntu 22.04.

Prerequisites
Sponsored

You need to install various tools such as curl, OpenSSH server, etc., to install and use GitLab on Ubuntu 22.04.

Firstly, update the system’s packages list by issuing the following command:

$ sudo apt update

Now, install the prerequisites by issuing the following command:

$ sudo apt install tzdata curl ca-certificates openssh-server


How to install GitLab on Ubuntu 22.04

Although GitLab is not available on the official repository of Ubuntu 22.04. However, we have an alternate method to get GitLab on Ubuntu 22.04. For a better understanding, we have divided the installation into various steps:

Step 1: At the time of this write-up, the Gitlab repository for Ubuntu 22.04 is not available. Here, we will configure the Gitlab repository for Focal-Fossa (Ubuntu 20.04) on Jammy Jellyfish (Ubuntu 22.04).

Firstly, you must import the GPG key by issuing the following command:

$ gpg_key_url=“https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey”

curl -fsSL $gpg_key_url| sudo gpg –dearmor -o /etc/apt/trusted.gpg.d/gitlab.gpg

Now, add the Gitlab repository of Ubuntu 20.04 inside the sources.list.d file of Ubuntu 22.04.

$ sudo tee /etc/apt/sources.list.d/gitlab_gitlab-ce.list

Step 2: After doing so, update the core libraries of Ubuntu 22.04 as follows:

$ sudo apt update

Now, execute the following command to install GitLab on Ubuntu 22.04:

$ sudo apt install gitlab-ce


The above command has installed the GitLab community edition on Ubuntu 22.04.

Verify the installation with the help of the following command:

$ sudo gitlab-rake gitlab:env:info

How to configure GitLab on Ubuntu 22.04

Although the installation of the GitLab has been completed successfully. However, you cannot use GitLab without proper configuration. The following steps would lead you to configure the GitLab before using it:

Step 1: GitLab listens to port 80 (http) and port 443 (https). Firstly, allow both ports on the firewall by using the following commands:

Sponsored
$ sudo ufw allow https

$ sudo ufw allow http

$ sudo ufw allow ssh

Reload the firewall settings to adapt to the above changes:

$ sudo ufw reload

Step 2: Check the web address where the Gitlab web interface will be accessible:

$ sudo nano /etc/gitlab/gitlab.rb

The web address can be found in the line that starts with “external_url” as shown in the above image.

Now, reconfigure the GitLab with the help of the following command:

$ sudo gitlab-ctl reconfigure


Step 3: Lastly, execute the following command to start the GitLab-server:

$ sudo gitlab-ctl start

You can also get the status of the GitLab services as follows:

$ sudo gitlab-ctl status

Moreover, the below-mentioned command allows you to restart the Gitlab web-services:

$ sudo gitlab-ctl start

How to remove GitLab from Ubuntu 22.04

GitLab is a very useful tool to develop software in a collaborative manner. If you are not using the GitLab services anymore then you can remove it from Ubuntu 22.04 by issuing the following command:

$ sudo apt remove gitlab-ce

You can also remove the GitLab repository from the apt list as follows:

$ sudo rm /etc/apt/sources.list.d/gitlab_gitlab-ce.list

Conclusion

GitLab is the widely used Git repository to track and manage the changes made to the source code of a program. Gitlab is exercised as a Version Control System (VCS) by organizations like NASA, IBM, Sony, SpaceX, Alibaba, and many more. This article provides the installation procedure of GitLab on Ubuntu 22.04. Apart from installation, you have learned the configuration, usage, and removal of GitLab on Ubuntu 22.04.

Ubuntu Server Admin

Recent Posts

How to Fix VMware’s “Could not open /dev/vmmon” Error on Ubuntu

You’ve recently installed VMware Workstation on your Ubuntu system and encountered the frustrating “Could not…

4 hours ago

How to Fix Ubuntu 404 Errors While Fetching Dependencies

Have you ever found yourself staring at a terminal full of 404 errors while trying…

4 hours ago

How to Fix ‘Please Install All Available Updates’ Error When Upgrading Ubuntu 18.04 to 20.04 LTS

One particularly frustrating error that many users face when trying to upgrade from Ubuntu 18.04 …

4 hours ago

How to fix “Release is not valid yet” Error in Docker Containers

In the world of containerization, time synchronization issues can create unexpected roadblocks when working with…

4 hours ago

How to fix “Externally Managed Environment” Pip Errors on Ubuntu

If you’ve recently upgraded to Ubuntu 23.04 or newer, you might have encountered a frustrating…

4 hours ago

Ubuntu now officially supports NVIDIA Jetson: powering the future of AI at the edge

Canonical announces the General Availability of Ubuntu for the NVIDIA® Jetson Orin™ for edge AI…

11 hours ago