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.
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:
Now, install the prerequisites by issuing the following command:
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:
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.
deb https://packages.gitlab.com/gitlab/gitlab-ce/ubuntu/ focal main
deb-src https://packages.gitlab.com/gitlab/gitlab-ce/ubuntu/ focal main
Step 2: After doing so, update the core libraries of Ubuntu 22.04 as follows:
Now, execute the following command to install GitLab on Ubuntu 22.04:
The above command has installed the GitLab community edition on Ubuntu 22.04.
Verify the installation with the help of the following command:
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:
$ sudo ufw allow http
$ sudo ufw allow ssh
Reload the firewall settings to adapt to the above changes:
Step 2: Check the web address where the Gitlab web interface will be accessible:
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:
Step 3: Lastly, execute the following command to start the GitLab-server:
You can also get the status of the GitLab services as follows:
Moreover, the below-mentioned command allows you to restart the Gitlab web-services:
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:
You can also remove the GitLab repository from the apt list as follows:
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.