How to Install GitLab CE (Community Edition): on CentOS Stream 9: A Step-by-Step Guide

GitLab Logo

GitLab is one of the most popular platforms for version control and DevOps lifecycle management. It provides a comprehensive set of features for developers and teams to collaborate effectively. In this guide, we will show you how to install GitLab CE (Community Edition) on CentOS Stream 9.

The GitLab installation in this tutorial will be consist of several sections, namely :

  1. Prerequisite
  2. Update CentOS Stream 9 Repository
  3. Install Dependencies
  4. Add GitLab CE Repositories
  5. Install GitLab CE Package On CentOS Stream 9
  6. Configure GitLab
  7. Adjust the Firewall
  8. Starting GitLab Service
  9. Access GitLab
  10. Conclusion
  11. FAQs

Prerequisites

Before we begin installing GitLab on CentOS Stream 9, ensure the following:

  1. System Requirements:
    • A CentOS Stream 9 system with a minimum of 4GB RAM and 2 CPUs.
    • At least 10GB of free disk space.
  2. Root Privileges: Ensure you have administrative access to your server.
  3. Dependencies:
    • Update your system packages and install essential tools like curl and wget.
  4. Firewall and SELinux: Allow ports 80 (HTTP), 443 (HTTPS), and 22 (SSH). Disable SELinux temporarily if necessary.

Step 1: Update CentOS Stream 9 Repository

Before we are going to add or modify an applications on the system, it is a good habit to update your system first. Keeping your system updated is crucial to avoid compatibility issues. Run the following commands:

sudo dnf update

Step 2 : Install Dependencies

To install GitLab on a new system, we are required to prepare dependencies packages need to be installed. Use the following command to install them:

sudo dnf install -y curl policycoreutils openssh-server openssh-clients

Step 3 : Add GitLab CE Repositories

The next step is to add GitLab CE repositories on your system. Submit the following command:

curl -O https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh

Output :

ramansah@node01 ~]$ curl -O https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 7939 100 7939 0 0 17920 0 --:--:-- --:--:-- --:--:-- 17920

Then we will have an new file as shown below :

[ramansah@node01 ~]$ ls -ltr *.sh
-rw-r--r--. 1 ramansah ramansah 7939 Jan 7 11:46 script.rpm.sh
Adding GitLab Repository

Step 4 : Install GitLab CE Package On CentOS Stream 9

After the repository has been added, then we will install it by submitting command :

sudo sh ./script.rpm.sh
install GitLab on CentOS Stream 9

If the installation was completed done successfully, then we will configure GitLab based on our requirements.

Step 5: Configure GitLab

The GitLab configuration file will located on /etc/gitlab/gitlab.rb file. you can configure GitLab by editing this configuration file:

sudo vi /etc/gitlab/gitlab.rb

In this configuration file, you can modify settings based on your requirements, like the external URL and email settings, then you need to save your changes and reconfigure GitLab by submitting command line:

sudo gitlab-ctl reconfigure

The output will be as shown below :

Submitting GitLab configuration file

Step 6: Adjust the Firewall

Until this section, we have just reached the end of tutorial. If you have a firewall running, then we will adjust the firewall setting on our CentOS Stream 9 system. On this section we will allow firewall to allow the connections to port 80, 443, and 7000.

sudo firewall-cmd --add-service={http,https}
sudo firewall-cmd --add-service=ssh
sudo firewall-cmd --runtime-to-permanent
sudo firewall-cmd --reload

Step 7 : Starting GitLab Service

On this step, we will start GitLab service by submitting command line :

sudo gitlab-ctl start

the output will be shown below :

[ramansah@node01 ~]$ sudo gitlab-ctl start
ok: run: alertmanager: (pid 40314) 376s
ok: run: gitaly: (pid 40304) 379s
ok: run: gitlab-exporter: (pid 40282) 381s
ok: run: gitlab-kas: (pid 39516) 749s
ok: run: gitlab-workhorse: (pid 40259) 382s
ok: run: logrotate: (pid 39123) 784s
ok: run: nginx: (pid 40268) 382s
ok: run: node-exporter: (pid 40274) 381s
ok: run: postgres-exporter: (pid 40322) 375s
ok: run: postgresql: (pid 39319) 760s
ok: run: prometheus: (pid 40292) 380s
ok: run: puma: (pid 39609) 627s
ok: run: redis: (pid 39184) 778s
ok: run: redis-exporter: (pid 40284) 381s
ok: run: sidekiq: (pid 39638) 616s

And then we will check the service by submitting command line :

sudo gitlab-ctl status

the output will be as shown below :

[ramansah@node01 ~]$ sudo gitlab-ctl status
run: alertmanager: (pid 40314) 459s; run: log: (pid 39967) 623s
run: gitaly: (pid 40304) 462s; run: log: (pid 39247) 852s
run: gitlab-exporter: (pid 40282) 464s; run: log: (pid 39844) 657s
run: gitlab-kas: (pid 39516) 832s; run: log: (pid 39527) 829s
run: gitlab-workhorse: (pid 40259) 465s; run: log: (pid 39692) 687s
run: logrotate: (pid 39123) 867s; run: log: (pid 39131) 866s
run: nginx: (pid 40268) 465s; run: log: (pid 39743) 681s
run: node-exporter: (pid 40274) 464s; run: log: (pid 39804) 667s
run: postgres-exporter: (pid 40322) 458s; run: log: (pid 40001) 612s
run: postgresql: (pid 39319) 843s; run: log: (pid 39341) 840s
run: prometheus: (pid 40292) 463s; run: log: (pid 39910) 635s
run: puma: (pid 39609) 710s; run: log: (pid 39618) 707s
run: redis: (pid 39184) 861s; run: log: (pid 39193) 860s
run: redis-exporter: (pid 40284) 464s; run: log: (pid 39875) 646s
run: sidekiq: (pid 39638) 699s; run: log: (pid 39648) 696s

Step 8: Access GitLab

Open your web browser and navigate to the external URL you configured. Log in with the initial root credentials provided during installation. Change the password for security.

We will use root user to login to GitLab where the password is located at /etc/gitlab/initial_root_password file, as shown below.

GitLab root password

The initial password is shown on this file, then we are advised to change this password.

Password: lU6SCBfk2C5n3r3maQgC5sNZzOBUezWrX/cCnR3hYZk=

After successfully logging in, we will find the GitLab main page as below:

GitLab main page for the first time use

Conclusion

Congratulations! You have successfully installed GitLab on CentOS Stream 9. You can now start using GitLab to manage your projects and collaborate with your team. For more advanced configurations and troubleshooting, refer to the official GitLab documentation.

FAQs

1. How do I upgrade GitLab?

  • Run:sudo dnf update gitlab-ce

2. What if I encounter a 502 error?

  • Restart GitLab services:sudo gitlab-ctl restart

3. Can I use GitLab Enterprise Edition (EE)?

  • Yes, follow the same steps but install gitlab-ee instead of gitlab-ce.

4. What is the difference between GitLab and GitLab CE (Community Edition) ?

The key difference between GitLab and GitLab CE (Community Edition) lies in their feature sets and intended audiences:

1. GitLab CE (Community Edition):

  • Free and Open Source: GitLab CE is fully open source and free to use.
  • Feature Set: Offers essential features for version control, CI/CD pipelines, and team collaboration.
  • Target Audience: Best suited for small to medium-sized teams and organizations looking for a cost-effective solution without requiring advanced enterprise-level features.

2. GitLab EE (Enterprise Edition):

Scalability: Designed for organizations with more complex needs, such as large teams, enhanced security requirements, and regulatory compliance.

Paid License: GitLab EE is a paid version that includes all CE features plus premium tools for large-scale enterprises.

Advanced Features: Includes features like advanced security scanning, performance monitoring, priority support, and multiple levels of compliance management.

(Visited 32 times, 1 visits today)

You may also like