Skip to content

How to Install GitLab in a Disconnected Environment

Avatar photo

https://www.linkedin.com/in/gineesh/ https://twitter.com/GiniGangadharan

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

Prerequisites

  • Server to install GitLab CE – Check requirements for CPU, Memory, storage details.
  • GitLab CE package downloaded
  • Operating System repositories

Download GitLab Package

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.

Transfer Package to the Server

You can use any of the allowed methods (scp, winscp etc) to transfer the package (RPM) to the GitLab server.

Install and Enable Dependancies

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

Install GitLab Server Offline

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.

GitLab Initial root Password

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

Access the GitLab CE Server

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.

Avatar photo


https://www.linkedin.com/in/gineesh/ https://twitter.com/GiniGangadharan
Gineesh Madapparambath is the founder of techbeatly and he is the author of the book - ๐—”๐—ป๐˜€๐—ถ๐—ฏ๐—น๐—ฒ ๐—ณ๐—ผ๐—ฟ ๐—ฅ๐—ฒ๐—ฎ๐—น-๐—Ÿ๐—ถ๐—ณ๐—ฒ ๐—”๐˜‚๐˜๐—ผ๐—บ๐—ฎ๐˜๐—ถ๐—ผ๐—ป. 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)

Comments

4 Responses

  1. […] 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 […]

  2. […] 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 […]

  3. Gulam Moideen says:

    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

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.