Automation / DevOps / How To
GitLab is an open source DevOps platform with functionalities such as Git server, CI/CD, DevSecOps and many other features. You can use hosted service at gitlab.com or you can install GitLab on your server and use it. However, most of the people using GitLab as a Git server rather than the full DevOps platform. Anyway, if you need a fully functional Git server for your environment, one of the best options is GitLab and you can install it for free by using GitLab CE (Community Edition). If you need support, then check for GitLab EE (Enterprise Edition).
Installing GitLab is a simple job as you just need to install the dependancies and then GitLab package. But the process is bit different when you do not have internet on your server (restricted or disconnected environment) on which you want to install GitLab.
In this tutorial, you will learn how to install GitLab CE in a disconnected (no Internet) server.
Learn how to install git server using gogs
Since we cannot simple install GitLab using package managers (yum, dnf, apt), we need to download the the package manually (from a machine with internet access) and transfer to the server.Download the package from packages.gitlab.com and in my case I am installing GitLab Ce on a RHEL8 server (Red Hat Enterprise Linux).
Find the rpm link (or whichever package you are installing) and click on the link. In my case I am downloading gitlab-ce-14.5.2-ce.0.el8.x86_64.rpm (el8) for RHEL8.
In the next screen, you will see the link for downloading the rpm file (Upper right corner as shown below). Click on the download link.
Note: You can download the rpm file using curl
from an internet connected machine as well.
$ wget --content-disposition https://packages.gitlab.com/gitlab/gitlab-ce/packages/el/8/gitlab-ce-14.5.2-ce.0.el8.x86_64.rpm/download.rpm
Check OpenShift BootCamp to learn OpenShift from scratch.
You can use any of the allowed methods (scp, winscp etc) to transfer the package (RPM) to the GitLab server.
Make sure you have access to the operating system repositories to install the dependancy packages. Eg: for RHEL8, make sure you have access to the Satellite server or local yum repositories enabled.
$ sudo dnf install -y \
curl \
policycoreutils \
openssh-server \
perl \
postfix \
openssl \
tzdata \
yum-utils
Make sure sshd
is working (If you are already connected via ssh then this steps is already done. If you are using server remote console, then enable sshd)
# Enable OpenSSH server daemon if not enabled:
sudo systemctl status sshd
sudo systemctl enable sshd
sudo systemctl start sshd
Enable firewall ports for GitLab access.
sudo systemctl status firewalld
$ sudo firewall-cmd --permanent --add-service=http && \
sudo firewall-cmd --permanent --add-service=https && \
sudo systemctl reload firewalld
Enable Postfix for email.
$ sudo dnf install postfix && \
sudo systemctl enable postfix && \
sudo systemctl start postfix
Now you can install GitLab CE package using dnf localinstall
(or use alternative command for your operating system). Remember to configure the environment variable for EXTERNAL_URL
and GITLAB_ROOT_PASSWORD
.
The EXTERNAL_URL
you are using should a valid DNS or you need to add the entry in your /etc/hosts
file on the client machine from where you are accessing the GitLab server.
$ sudo EXTERNAL_URL="http://gitlab.lab.local" \
GITLAB_ROOT_PASSWORD="gitlabadmin" \
dnf localinstall -y gitlab-ce-14.5.2-ce.0.el8.x86_64.rpm
Note: If any error with gpgcheck
, then disable gpgcheck
by adding --nogpgcheck
at the end of dnf
or yum
command.
If you missed to mention the root
password while installing, then get the default random password generated by installer. (This password will be removed by gitlab-ctl reconfigure
later.)
$ sudo cat /etc/gitlab/initial_root_password
Now you can access the GitLab CE server from a browser using the EXTERNAL_URL
you have configured (eg: http://gitlab.lab.local).
Refer GitLab official documentation for further reading.
Disclaimer:
The views expressed and the content shared in all published articles on this website are solely those of the respective authors, and they do not necessarily reflect the views of the author’s employer or the techbeatly platform. We strive to ensure the accuracy and validity of the content published on our website. However, we cannot guarantee the absolute correctness or completeness of the information provided. It is the responsibility of the readers and users of this website to verify the accuracy and appropriateness of any information or opinions expressed within the articles. If you come across any content that you believe to be incorrect or invalid, please contact us immediately so that we can address the issue promptly.
Tags: CICD · Devops · git · gitlab ce · gitlab ce installation offline · install gitlab offline
Gineesh Madapparambath
Gineesh Madapparambath is the founder of techbeatly and he is the co-author of The Kubernetes Bible, Second Edition. and the author of 𝗔𝗻𝘀𝗶𝗯𝗹𝗲 𝗳𝗼𝗿 𝗥𝗲𝗮𝗹-𝗟𝗶𝗳𝗲 𝗔𝘂𝘁𝗼𝗺𝗮𝘁𝗶𝗼𝗻.
He has worked as a Systems Engineer, Automation Specialist, and content author. His primary focus is on Ansible Automation, Containerisation (OpenShift & Kubernetes), and Infrastructure as Code (Terraform).
(aka Gini Gangadharan - iamgini.com)
This site uses Akismet to reduce spam. Learn how your comment data is processed.4 Responses
Leave a Reply Cancel reply
[…] have explained How to Install GitLab in a Disconnected Environment in a past article. In this article you will learn how to use self-signed or custom SSL certificates […]
[…] have explained How to Install GitLab in a Disconnected Environment in a past article. In this article you will learn how to configure custom storage path for your […]
Hi , Gineesh Madapparambath
I’ve gone through your document it is really helpful doc for the air-gapped env solutions.
I’ve one query that I’ve already gitlab installed and configured in an air-gapped (offline) environment. But I want to upgrade the gitlab version to a specific release.
How can we make it possible?. Any suggestions are welcome.
Best Regards,
Gulam
Yes, download the latest version of GitLab rpm as you did first time.
Then transfer the same to the disconnected machine.
Then do the installation; eg”: sudo yum install gitlab-ee-15.2.5-ee.0.el8.x86_64.rpm