Install gitlab on ubuntu 22. 04

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

Text description automatically generated

Now, install the prerequisites by issuing the following command:

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

Text description automatically generated
Text description automatically generated

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:

See also  How to Install Apache Subversion on Ubuntu

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

Install gitlab on ubuntu 22. 04 1

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<

Text description automatically generated

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

$ sudo apt update

Text description automatically generated

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

$ sudo apt install gitlab-ce

Text description automatically generated
Text description automatically generated

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

Text description automatically generated

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

Graphical user interface description automatically generated

Reload the firewall settings to adapt to the above changes:

$ sudo ufw reload

A picture containing text description automatically generated

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

$ sudo nano /etc/gitlab/gitlab.rb

Text description automatically generated

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

Text description automatically generated
Install gitlab on ubuntu 22. 04 2

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

$ sudo gitlab-ctl start

Text description automatically generated

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

$ sudo gitlab-ctl status

Text description automatically generated

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

$ sudo gitlab-ctl start

Text description automatically generated

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

Text description automatically generated

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

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

Install gitlab on ubuntu 22. 04 3

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.


Discover more from Ubuntu-Server.com

Subscribe to get the latest posts sent to your email.

Comments

No comments yet. Why don’t you start the discussion?

    Leave a Reply