GitLab is an open-core company that offers a powerful DevOps software package, allowing developers to seamlessly develop, secure, and operate software within a single application. With its robust features and user-friendly interface, GitLab has become a popular choice among developers and organizations worldwide. In this article, we will walk you through the step-by-step process of installing GitLab on AlmaLinux 9, enabling you to leverage its capabilities for your development projects.
Prerequisites
Before we dive into the installation process, there are a few prerequisites that need to be met in order to ensure a smooth installation. Here’s what you’ll need:
- AlmaLinux 9 installed on your system.
- A minimum of 4GB of system RAM.
- Administrative access to the system.
Step 1: Update the System
The first step in the installation process is to update the system and ensure that all available packages are up to date. Open your terminal and execute the following commands:
yum update -y yum upgrade -y
This will update your system with the latest packages and security patches, ensuring a stable environment for GitLab installation.
Step 2: Install the Required Packages
Next, we need to install the necessary packages and dependencies for GitLab. Execute the following command in your terminal:
dnf -y install curl vim policycoreutils python3-policycoreutils git
This command will install the required packages, including curl
, vim
, policycoreutils
, python3-policycoreutils
, and git
, which are essential for GitLab to function properly.
Step 3: Add the GitLab CE Repository on AlmaLinux 9
To install GitLab on AlmaLinux 9, we need to add the GitLab CE repository. Open the terminal and execute the following command to create a new file for the repository:
vim /etc/yum.repos.d/gitlab_gitlab-ce.repo
This command will open a text editor. Paste the following lines into the file:
[gitlab_gitlab-ce]
name=gitlab_gitlab-ce
baseurl=https://packages.gitlab.com/gitlab/gitlab-ce/el/8/$basearch
repo_gpgcheck=1
gpgcheck=1
enabled=1
gpgkey=https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey
https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey/gitlab-gitlab-ce-3D645A26AB9FBD22.pub.gpg
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300
[gitlab_gitlab-ce-source]
name=gitlab_gitlab-ce-source
baseurl=https://packages.gitlab.com/gitlab/gitlab-ce/el/8/SRPMS
repo_gpgcheck=1
gpgcheck=1
enabled=1
gpgkey=https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey
https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey/gitlab-gitlab-ce-3D645A26AB9FBD22.pub.gpg
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300
Save the file and exit the text editor.
To verify if the repository has been successfully added, run the following command:
dnf repolist
You should see the GitLab CE repository listed among the repositories.
Step 4: Install GitLab CE on AlmaLinux 9
With the repository added, we can now proceed with the installation of GitLab CE. Execute the following command in your terminal:
dnf install gitlab-ce -y
This command will download and install GitLab CE along with its dependencies. Please note that this process may take some time, depending on your internet connection and system specifications.
Once the installation is complete, GitLab CE will be ready to use on your AlmaLinux 9 system.
Step 5: Configure GitLab CE on AlmaLinux 9
Before we can start using GitLab, we need to configure it by editing the GitLab configuration file. Open the file in your text editor using the following command:
vim /etc/gitlab/gitlab.rb
In the configuration file, locate the line that starts with external_url
and replace the placeholder http://gitlab.example.com
with the actual domain or IP address you want to use for accessing your GitLab instance.
Save the file and apply the changes by running the following command:
gitlab-ctl reconfigure
This command will apply the configuration changes and set up GitLab CE on your AlmaLinux 9 system.
Step 6: Verify GitLab Installation
To ensure that GitLab has been successfully installed and configured, you can check its running status. Execute the following command in your terminal:
gitlab-ctl status
This command will display the status of various GitLab components, indicating whether they are running or not.
Step 7: Firewall Configuration
By default, AlmaLinux 9 uses the firewalld service to manage the system’s firewall rules. In order to access GitLab through a web browser, you need to allow HTTP and HTTPS traffic through the firewall. Use the following commands to configure the firewall:
firewall-cmd --permanent --zone=public --add-service=http firewall-cmd --permanent --zone=public --add-service=https firewall-cmd --reload
These commands will open the necessary ports for GitLab to communicate over HTTP and HTTPS protocols.
Step 8: Access GitLab Web Console
Once the firewall has been configured, you can access the GitLab web console by visiting the URL http://Your_Domain_Name
in your web browser. Replace Your_Domain_Name
with the actual domain or IP address you configured in the GitLab configuration file.
To log in to GitLab for the first time, you will need the initial root password. You can retrieve it by running the following command:
cat /etc/gitlab/initial_root_password
This command will display the initial root password. It is highly recommended to reset the password after the initial login for security reasons.
Congratulations! You have successfully installed and configured GitLab CE on AlmaLinux 9. You can now start using GitLab to streamline your development processes and collaborate with your team more efficiently.
Conclusion
GitLab is a powerful DevOps software package that allows developers to develop, secure, and operate software in a single application. By following the step-by-step guide in this article, you have successfully installed GitLab CE on your AlmaLinux 9 system. You are now ready to leverage the features and capabilities of GitLab to enhance your development workflow.
If you are looking for reliable and scalable cloud hosting services, Shape.host offers Linux SSD VPS solutions to meet your needs. With Shape.host, you can enjoy high-performance hosting backed by excellent customer support. Visit Shape.host to explore their hosting options and take your projects to the next level.