GitLab is a free, open-source, web-based DevOps software solution that combines the ability to develop, secure, and operate software in a single application. It is written in Ruby and used by thousands of organizations worldwide. GitLab is a Git repository manager that offers a lot of features including issue tracking, continuous integration, deployment pipeline, and more. It comes in two editions, the Enterprise Edition and the Community Edition. It is very similar to GitHub and allows you to integrate it with various services. You can host your own repository using GitLab in a development environment that allows developers to host their projects.
In this post, we will show you how to install the GitLab community edition on Oracle Linux 8.
- A server running Oracle Linux 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 Oracle Linux 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 Server
Before starting, you will need to install the Postfix package to include mail functionality. You can install it using the following command:
dnf install postfix
After the installation, start the Postfix service and enable it to start at system reboot:
systemctl enable --now postfix
Step 3 – Add GitLab CE Repository
By default, the GitLab package is not included in the Oracle 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 script is downloaded, set execution permissions using 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 now check the repository using the following command:
You should see the GitLab repository in the following output:
repo id repo name
ol8_UEKR6 Latest Unbreakable Enterprise Kernel Release 6 for Oracle Linux 8 (x86_64)
ol8_appstream Oracle Linux 8 Application Stream (x86_64)
ol8_baseos_latest Oracle Linux 8 BaseOS Latest (x86_64)
pgdg-common PostgreSQL common RPMs for RHEL / Oracle 8 - x86_64
pgdg10 PostgreSQL 10 for RHEL / Oracle 8 - x86_64
pgdg11 PostgreSQL 11 for RHEL / Oracle 8 - x86_64
pgdg12 PostgreSQL 12 for RHEL / Oracle 8 - x86_64
pgdg13 PostgreSQL 13 for RHEL / Oracle 8 - x86_64
pgdg14 PostgreSQL 14 for RHEL / Oracle 8 - x86_64
Step 4 – Install GitLab CE on Oracle Linux 8
At this point, the GitLab CE repo is added to the server. You can 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
For a comprehensive list of configuration options please see the Omnibus GitLab readme
Step 5 – Configure GitLab CE
GitLab is now installed on your system, but it is not configured yet. You can configure it by editing /etc/gitlab/gitlab.rb file:
Define your external UR and 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.
NOTE: Because these credentials might be present in your log files in plain text, it is highly recommended to reset the password following https://docs.gitlab.com/ee/security/reset_user_password.html#reset-your-root-password.
The above command will configure GitLab and store the access credentials in the /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 Dashboard
Now, open your web browser and 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 and password and click on the Sign in button. You should see the GitLab dashboard on the following page:
Step 7 – Backup GitLab
It is a good idea to back up your GitLab instance regularly. To back up the GitLab instance, run 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 learned how to install GitLab CE on Oracle Linux 8. We also learned how to edit the GitLab CE and enable the Let’s Encrypt SSL. Your GitLab instance is now installed and secured. You can now start using GitLab in a local development environment to track all projects. Get started on VPS hosting from Atlantic.Net.