LinuxUbuntu

How to Install GitLab Self-Hosting on Ubuntu 24.04

Illustration of the process for installing GitLab on Ubuntu 24.04.

What’s GitLab

GitLab is an open-source DevOps platform that provides a suite of tools for managing repositories, continuous integration/continuous deployment (CI/CD), and more. Using GitLab can streamline your development workflow and aid in project management.

Prerequisites

  • A server running Ubuntu 24.04 or newest
  • A domain name pointing to your server’s IP address (optional but recommended).
  • Basic knowledge of terminal commands.

How to Install GitLab

Update and Upgrade Your System

Before installing any new software, it’s a good practice to update and upgrade your system:

apt update && apt upgrade -y

# Reboot to make sure the Linux used latest kernel
reboot

Install Required Dependencies

GitLab requires some dependencies to be installed. Install them using the following commands:

apt install -y curl openssh-server ca-certificates tzdata perl

Install Exim4 for Sending Email Notifications

You can use Exim4 for sending email notifications. Install it using the following command:

apt install -y exim4

Check the domain (HTTPS)

Make sure the domain name pointing to the server IP Address to make the SSL deployment automatically. After the domain pointing to the server IP, you could check using dig or host command:

dig a gitlab.blackonsole.org

# OR

host -t a gitlab.blackonsole.org

Add the GitLab Repository

Add GitLab APT Repository before installing the packages. You could run by script:

curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.deb.sh | sudo bash

Install the Package

Download and install the GitLab package. You’ll need to use curl to download the script and then run it:


EXTERNAL_URL="https://gitlab.blackonsole.org" apt install -y gitlab-ee

...

gitlab Reconfigured!

       *.                  *.
      ***                 ***
     *****               *****
    .******             *******
    ********            ********
   ,,,,,,,,,***********,,,,,,,,,
  ,,,,,,,,,,,*********,,,,,,,,,,,
  .,,,,,,,,,,,*******,,,,,,,,,,,,
      ,,,,,,,,,*****,,,,,,,,,.
         ,,,,,,,****,,,,,,
            .,,,***,,,,
                ,*,.



     _______ __  __          __
    / ____(_) /_/ /   ____ _/ /_
   / / __/ / __/ /   / __ `/ __ \
  / /_/ / / /_/ /___/ /_/ / /_/ /
  \____/_/\__/_____/\__,_/_.___/


Thank you for installing GitLab!
GitLab should be available at https://gitlab.blackonsole.org
...

Check GitLab Services

To check the GitLab services running, you could use this command:

systemctl status gitlab-runsvdir.service

Configure GitLab

To configure GitLab, run the following command:

vim /etc/gitlab/gitlab.rb
# Configure you needed, then
# reconfigure GitLab to apply the config file
gitlab-ctl reconfigure

 Access GitLab Web Interface

Open your web browser and go to your server’s domain name or IP address. For example:

https://gitlab.blackonsole.org

Where the default of user is root with the generated password in this file:

cat /etc/gitlab/initial_root_password

Conclusion

By following these steps, you should have GitLab up and running on your Ubuntu 24.04 server. GitLab offers a comprehensive suite of tools that can significantly improve your development process and team collaboration.

Reference

Hi, I’m Sysadmin.ID

Leave a Reply

Your email address will not be published. Required fields are marked *