GitLab is a powerful DevOps software that provides a single application for developing, securing, and operating software. With its free and open-source Community Edition (CE), GitLab offers unlimited repositories and collaborators. It is an excellent platform for hosting Git repositories and comes with additional features like issue tracking. In this guide, we will walk you through the process of installing GitLab CE on Alma Linux 8.
Prerequisites
Before we begin, let’s ensure that you have the necessary prerequisites in place:
- A server running Alma Linux 8.
- A valid domain name pointed to your server’s IP address.
- A configured root password on the server.
Adding the GitLab CE Repository
By default, the GitLab package is not included in the Alma Linux default repository. To add the official GitLab repository to your system, follow these steps:
- Open a terminal on your Alma Linux 8 server.
- Run the following command to download and add the GitLab repository script:
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | bash
This script will add the GitLab CE repository to your system.
- Verify that the repository has been successfully installed by running the following command:
cat /etc/yum.repos.d/gitlab_gitlab-ce.repo
You should see the GitLab CE repository configuration displayed.
Installing GitLab CE on Alma Linux 8
Now that we have added the GitLab CE repository, we can proceed with the installation process. Follow these steps:
- Open a terminal on your Alma Linux 8 server.
- Run the following command to install GitLab CE:
dnf install gitlab-ce -y
This command will download and install GitLab CE on your system.
- Once the installation is complete, you can start configuring GitLab by running the following command:
gitlab-ctl reconfigure
This command will configure GitLab and set it up for first-time use.
- After the configuration is complete, you can check the status of GitLab using the following command:
gitlab-ctl status
You should see a list of GitLab components and their respective statuses.
Configuring GitLab CE
Now that GitLab is installed, we need to configure it to work with your domain name. Follow these steps:
- Open the GitLab configuration file using a text editor. For example:
nano /etc/gitlab/gitlab.rb
- Locate the line that starts with
external_url
and replace the placeholder URL with your actual domain name. For example:
external_url 'http://gitlab.example.com'
- Save and close the file.
- Reconfigure GitLab to apply the changes by running the following command:
gitlab-ctl reconfigure
- Once the reconfiguration is complete, you can access GitLab by navigating to the URL you specified in the configuration file.
Accessing GitLab CE
To access GitLab CE, follow these steps:
- Retrieve the GitLab root password by running the following command:
cat /etc/gitlab/initial_root_password
- You will see the GitLab CE root password displayed. Note it down.
- Open a web browser and enter the URL of your GitLab instance. For example,
http://gitlab.example.com
. - You will be redirected to the GitLab login page. Enter the root username and password you retrieved earlier.
- After successfully logging in, you will have access to the GitLab web interface.
Configuring Firewall
To ensure that GitLab is accessible through your firewall, you need to allow HTTP traffic. Follow these steps:
- Open a terminal on your Alma Linux 8 server.
- Run the following command to allow HTTP traffic:
firewall-cmd --permanent --add-service=http
- Reload the firewall configuration for the changes to take effect:
systemctl reload firewalld
Configuring GitLab Backup
GitLab provides a convenient backup feature to safeguard your data. Follow these steps to configure GitLab backup:
- Open a terminal on your Alma Linux 8 server.
- To create a backup of your GitLab instance, run the following command:
gitlab-rake gitlab:backup:create
- The backup process will begin, and you will see the progress displayed in the terminal.
- By default, GitLab backups are stored in the
/var/opt/gitlab/backups
directory. You can change this location by modifying the GitLab configuration file at/etc/gitlab/gitlab.rb
. - To verify that the backup was created successfully, run the following command:
ls /var/opt/gitlab/backups
You should see the backup file listed.
Resetting GitLab Root Password
If you forget your GitLab administrator password, you can easily reset it. Follow these steps:
- Open a terminal on your Alma Linux 8 server.
- Run the following command to reset the GitLab root password:
gitlab-rake "gitlab:password:reset"
- You will be prompted to enter a new password for the root user. Follow the instructions provided.
- Once you have successfully reset the password, you can log in to GitLab using the new password.
Conclusion
Congratulations! You have successfully installed GitLab CE on Alma Linux 8. You now have a powerful DevOps platform at your disposal for managing your software development projects. GitLab offers a wide range of features and capabilities to streamline your development workflow and enhance collaboration. Remember to regularly back up your GitLab instance to ensure the safety of your data. If you have any further questions or need assistance, feel free to reach out to Shape.host, a leading provider of Cloud VPS and hosting solutions.