Install GitLab on Ubuntu 22.04

GitLab is a DevOps, web-based, free, and open-source platform Git repository that provides all the essentials to developers. It is a one-unit platform for developing DevOps applications. GitLab also permits you to perform source code management, monitoring, security, and project planning tasks.

This guide will talk about the installation, usage, and uninstallation of GitLab on Ubuntu 22.04.

GitLab installation on Ubuntu 22.04

To install GitLab on Ubuntu 22.04, follow the steps given below.

Step 1: Update system packages

Open the system terminal using “CTRL+ALT+T” and execute the given command to update and upgrade system packages:

$ sudo apt update && sudo apt upgrade -y

Move to the next step for additional dependencies installation.

Step 2: Install necessary dependencies

Install necessary dependencies using the below command:

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

Step 3: Import GPG key

Import the GPG key into Ubuntu 22.04 so we can use third-party software:

$ 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

Let’s continue to the next step.

Step 4: Add GitLab repository

Import and add the repository of GitLab into the system:

$ sudo tee /etc/apt/sources.list.d/gitlab_gitlab-ce.list<<EOF
deb https://packages.gitlab.com/gitlab/gitlab-ce/ubuntu/ focal main
deb-src https://packages.gitlab.com/gitlab/gitlab-ce/ubuntu/ focal main
EOF

Step 5: Update system packages

Once the repository has been imported, update the system packages again:

$ sudo apt update

Step 6: Install GitLab

Now, install GitLab on Ubuntu 22.04 by utilizing the provided command:

$ sudo apt install gitlab-ce

Move to the next step to confirm GitLab installation.

Step 7: Configure GitLab

Configure the GitLab installation using the provided command:

$ sudo gitlab-ctl reconfigure

Step 8: Confirm GitLab installation

Confirm the GitLab installation by viewing the related information:

$ sudo gitlab-rake gitlab:env:info

As you can see, information about the system and GitLab is successfully displayed:

Step 9: Enable required ports

In the next step, enable the required ports. First, enable the “https” port:

$ sudo ufw allow https

Next, enable the “http” port:

$ sudo ufw allow http

After that, enable the “ssh” port:

$ sudo ufw allow ssh

Lastly, reload the Firewall:

$ sudo ufw reload

Step 10: Start GitLab service

Start the system services of GitLab:

$ sudo gitlab-ctl start

Step 11: Check services status

Check out the GitLab services with the help of the given command:

$ sudo gitlab-ctl status

We have successfully installed and configured the GitLab on Ubuntu 22.04.

Use GitLab on Ubuntu 22.04

To use GitLab on Ubuntu 22.04, follow up the below-mentioned procedure.

First, utilize the nano text editor to open the “gitlab.rb” file and look for the URL to access GitLab:

$ sudo nano /etc/gitlab/gitlab.rb

Navigate to the below-given link to access GitLab on Ubuntu 22.04:

http://gitlab.example.com

Let’s move ahead to remove GitLab from Ubuntu 22.04.

How to remove GitLab on Ubuntu 22.04?

To remove GitLab from Ubuntu 22.04, follow the below command:

$ sudo apt remove gitlab-ce

In order to remove GitLab directory, type the given “rm” command:

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

We have discussed the procedure to install, use, and remove GitLab on Ubuntu 22.04.

Conclusion

To install GitLab on Ubuntu 22.04, it is necessary to import the GPG key and its repository into the system. After that, update the system packages and execute the “$ sudo apt install gitlab-ce” command for GitLab installation. Then, configure it on Ubuntu 22.04. To use GitLab on Ubuntu 22.04, navigate to the “http://gitlab.example.com” URL. We have elaborated the instructions to install, use, and remove GitLab on Ubuntu 22.04.

Over 500 Million Views on Our Blogs and YouTube! We’re inviting 10 businesses to partner with us and grow together. Click here to join us! ×