GitLab is a free, open-source, and web-based Git repository manager and DevOps tool. It comes with a lot of features including issue tracking, continuous integration, deployment pipeline, and more. It offers two editions, the Enterprise Edition and the Community Edition. It is an alternative to GitHub that supports integration with various services. With GitLab, you can host your own internal repository for a development team and allow users to host their projects.
In this post, we will show you how to install the GitLab community edition on Rocky Linux 8.
- A server running RockyLinux 8 on the Atlantic.Net Cloud Platform
- A root password is configured on your server
Step 1 – Create Atlantic.Net Cloud Server
First, log in to your Atlantic.Net Cloud Server. Create a new server, choosing Rocky Linux 8 as the operating system with at least 4GB RAM. Connect to your Cloud Server via SSH and log in using the credentials highlighted at the top of the page.
Once you are logged in to your server, run the following command to update your base system with the latest available packages.
dnf update -y
Step 2 – Install Postfix
Before starting, you will need to install the Postfix package on your server. You can install it using the following command:
dnf install postfix
Once Postfix is installed, start the Postfix service and enable it to start at system reboot:
systemctl enable --now postfix
Step 3 – Add GitLab CE Repository
By default, GitLab is not included in the Rocky Linux default repo, so you will need to add a repository from the GitLab installation script.
First, download the script from the GitLab using the following command:
Once the download is completed, set execution permissions with the following command:
chmod +x script.rpm.sh
Next, run the script to add the GitLab CE repository.
os=el dist=8 ./script.rpm.sh
Once the repository has been created, you should get the following output:
Generating yum cache for gitlab_gitlab-ce...
Importing GPG key 0x51312F3F:
Userid : "GitLab B.V. (package repository signing key) <[email protected]>"
Fingerprint: F640 3F65 44A3 8863 DAA0 B6E0 3F01 618A 5131 2F3F
From : https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey
Importing GPG key 0xF27EAB47:
Userid : "GitLab, Inc. <[email protected]>"
Fingerprint: DBEF 8977 4DDB 9EB3 7D9F C3A0 3CFC F9BA F27E AB47
From : https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey/gitlab-gitlab-ce-3D645A26AB9FBD22.pub.gpg
Generating yum cache for gitlab_gitlab-ce-source...
The repository is setup! You can now install packages.
You can check the repository using the following command:
You should get the following output:
repo id repo name
appstream Rocky Linux 8 - AppStream
baseos Rocky Linux 8 - BaseOS
epel Extra Packages for Enterprise Linux 8 - x86_64
epel-modular Extra Packages for Enterprise Linux Modular 8 - x86_64
extras Rocky Linux 8 - Extras
remi-modular Remi's Modular repository for Enterprise Linux 8 - x86_64
remi-safe Safe Remi's RPM repository for Enterprise Linux 8 - x86_64
Step 4 – Install GitLab CE
Now, install GitLab CE using the following command:
dnf install gitlab-ce -y
Once GitLab has been installed, you should get the following output:
It looks like GitLab has not been configured yet; skipping the upgrade script.
_______ __ __ __
/ ____(_) /_/ / ____ _/ /_
/ / __/ / __/ / / __ `/ __ \
/ /_/ / / /_/ /___/ /_/ / /_/ /
Thank you for installing GitLab!
GitLab was unable to detect a valid hostname for your instance.
Please configure a URL for your GitLab instance by setting `external_url`
configuration in /etc/gitlab/gitlab.rb file.
Then, you can start your GitLab instance by running the following command:
sudo gitlab-ctl reconfigure
Step 5 – Configure GitLab CE
At this point, GitLab is installed in your system but it is not configured yet. You can configure it by editing /etc/gitlab/gitlab.rb file:
Define your external URL, email address and enable Let’s Encrypt as shown below:
# Enable the Let's encrypt SSL
letsencrypt['enable'] = true
# This is optional to get SSL related alerts
letsencrypt['contact_emails'] = ['[email protected]']
# This example renews every 7th day at 12:30
letsencrypt['auto_renew_hour'] = "12"
letsencrypt['auto_renew_minute'] = "30"
letsencrypt['auto_renew_day_of_month'] = "*/7"
Save and close the file then run the following command to configure GitLab.
Once the configuration has been completed, you should get the following output:
Default admin account has been configured with following details:
Password: You didn't opt-in to print initial root password to STDOUT.
Password stored to /etc/gitlab/initial_root_password. This file will be cleaned up in first reconfigure run after 24 hours.
The above command will configure GitLab and store the access credential in /etc/gitlab/initial_root_password file.
You can check the access password using the following command:
You should get the following output:
Step 6 – Access GitLab CE
You can now access the GitLab CE web UI using the URL https://gitlab.linuxbuz.com. You will be redirected to the GitLab login page:
Provide your root username, password and click on the Sign-in button. You should see the GitLab dashboard on the following page:
Step 7 – Backup GitLab
It is recommended to back up your GitLab instance per month. You can back up the GitLab instance using the following command:
It is also a good idea to make your backups automatic. You can do it by creating a cron job.
Add the following line:
0 22 * * * gitlab-rake gitlab:backup:create
Save and close the file when you are finished.
In this guide, we explained how to install GitLab CE on Rocky Linux 8. You can now implement GitLab in your local development to track your all projects. Get started on dedicated hosting from Atlantic.Net.