Skip to content

Set Up GitLab on a Linux Server – Host Your Own DevOps Platform

Discover how to efficiently install GitLab on Linux to optimize DevOps workflows and enhance team collaboration → Learn more now

12 November 20266 min read15 Views0 helpful

Introduction

GitLab is a comprehensive DevOps platform that enables teams to collaborate on code, automate workflows, and efficiently manage the entire software development lifecycle. This guide explains how to install GitLab on a Linux server.

Installing GitLab with One-Click Apps

You can install GitLab directly via One-Click Apps in the VPS web interface. After the initial setup of the apps, open the app catalog, search for GitLab, and start the deployment with your preferred project, environment, and domain settings. This allows you to deploy and manage GitLab quickly and user-friendly without manual command-line setups, while still benefiting from integrated web-based management, support for custom domains, and SSL provisioning where available.

Preparation

The following requirements are recommended by the official GitLab Team. It is highly advisable to meet these prerequisites to avoid future issues and inconveniences.

Hardware

ComponentsMinimumRecommended
CPU2x 2 GHz4x 2.6+ GHz
RAM4 GB8 GB
Storage10 GB50+ GB
Bandwidth100 Mbit/s (Up & Down)100 Mbit/s (Up & Down)

Software

PlatformOptions
Operating SystemUbuntu (20.04, 22.04, 24.04), Debian (10, 11, 12), OpenSUSE (15.5)
DatabasePostgreSQL 14.9+
Web ServerNGINX (bundled with GitLab), Puma 6.4.2+
OthersRedis 7.x+, Sidekiq 7.3.2+, Prometheus 2.54.1+
Info

For the latest and most accurate specifications, please check the official Hardware Requirements documentation from GitLab.

To install GitLab on your Linux server, you need to connect via SSH client. Refer to our First Access (SSH) guide.

Once connected, you can install the necessary packages required for GitLab installation.

Step 1: Install Dependencies

First, you need to install some dependencies so the GitLab installer can run. Use the following commands to install the required packages on your Linux server.

Update the package list and install the OpenSSH server along with the required prerequisites with this command. This will host your GitLab web interface.

Code
sudo apt update
sudo apt-get install -y curl openssh-server ca-certificates tzdata perl

Optionally, you can install Postfix (SMTP server) if you want to send email notifications via GitLab.

If you want to use email notifications, install Postfix with:

Code
sudo apt-get install -y postfix

Update the package list and install the OpenSSH server and required prerequisites with the following command. This will host your GitLab web interface.

Code
sudo apt update
sudo apt-get install -y curl openssh-server ca-certificates perl

Optionally, install Postfix (SMTP server) if you want to send email notifications via GitLab.

If you want to use email notifications, install Postfix with:

Code
sudo apt-get install -y postfix

Install the OpenSSH server and required prerequisites with the following command. This will host your GitLab web interface.

Code
sudo zypper install curl openssh perl

Make sure the OpenSSH daemon is enabled:

Code
sudo systemctl status sshd
sudo systemctl enable sshd
sudo systemctl start sshd

If you use firewalld, ensure the necessary ports are open.

Check if firewalld is active with:

bash
sudo systemctl status firewalld

If yes, open the standard ports (80 and 443):

Code
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo systemctl reload firewalld

Optionally, install Postfix (SMTP server) if you want to send email notifications via GitLab.

If you want to use email notifications, install Postfix with:

Code
sudo zypper install postfix
sudo systemctl enable postfix
sudo systemctl start postfix
Info

During the Postfix installation, a configuration screen may appear. Choose “Internet Site” and confirm with Enter. Enter the external DNS of your Linux server as the “mail name” and confirm. If more screens appear, confirm each with Enter to accept the default values. If you want to use another solution for email sending, skip this step and configure an external SMTP server after GitLab installation following the official guide.

Step 2: Install GitLab

After all dependencies are installed, you can install GitLab.

In this guide, we install GitLab directly from the official package repositories.

The following script adds the GitLab repositories to the apt package manager:

Code
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.deb.sh | sudo bash

Then you can install the gitlab-ee package:

bash
sudo apt-get install -y gitlab-ee

The following script adds the GitLab repositories to the Zypper package manager:

Code
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh | sudo bash

Then you can install the gitlab-ee package:

bash
sudo zypper install gitlab-ee

After this process completes, GitLab should be ready to use on your Linux server. In the next section, you will configure important settings to ensure the server runs smoothly.

Step 3: Configure GitLab

To make everything work, you need to make some changes to the configuration file. Open the GitLab configuration file with your preferred text editor. Here we use the preinstalled nano editor as an example.

Code
sudo nano /etc/gitlab/gitlab.rb

Find the line external_url and enter either your domain or the IP address of your Linux server if you do not want to use a domain for GitLab.

Code
## GitLab URL
##! URL where GitLab will be accessible.
##! For more details on configuring external_url see:
##! https://docs.gitlab.com/omnibus/settings/configuration.html#configuring-the-external-url-for-gitlab
##!
##! Note: During installation/updates, the environment variable
##! EXTERNAL_URL is used to set/override this value.
##! For AWS EC2 instances, it tries to retrieve the public hostname/IP
##! from AWS. More info:
##! https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
external_url 'http`s`://`your-domain-or-linux-server-ip`'

We also recommend entering your email address in the line letsencrypt['contact_emails']. This allows Let's Encrypt to notify and contact you about automatic and free SSL certificates.

Info

For a free SSL certificate from Let's Encrypt, you need a domain. You cannot request a certificate directly for an IP address.

Code
################################################################################
# Let's Encrypt Integration
################################################################################
# letsencrypt['enable'] = nil
# letsencrypt['contact_emails'] = [`your-email@example.com`] # This should be an array of email addresses
# letsencrypt['group'] = 'root'
# letsencrypt['key_size'] = 2048
# letsencrypt['owner'] = 'root'
# letsencrypt['wwwroot'] = '/var/opt/gitlab/nginx/www'
# See https://docs.gitlab.com/omnibus/settings/ssl/index.html#renew-the-certificates-automatically for more info
# letsencrypt['auto_renew'] = true
# letsencrypt['auto_renew_hour'] = 0
# letsencrypt['auto_renew_minute'] = nil # Should be a number or cron expression if specified.
# letsencrypt['auto_renew_day_of_month'] = "*/4"
# letsencrypt['auto_renew_log_directory'] = '/var/log/gitlab/lets-encrypt'
# letsencrypt['alt_names'] = []
Tip

You can press CTRL+W to search for letsencrypt['contact_emails'] and press Enter so you don’t have to scroll through the entire file manually.

When finished, press CTRL+X, then Y and Enter to save the changes.

Finally, run the following command to reconfigure GitLab with the new settings:

Code
sudo gitlab-ctl reconfigure

This process may take a while as GitLab initializes with the updated configuration data. If a domain was used, SSL certificates will also be automatically issued.

Step 4: Access the Web Interface

After initialization, the server should now be accessible via a web browser. Open your site by entering your domain or IP address:

Code
https://[your_domain] OR http://[your_ip_address]

On first access, the login page will appear.

For the first login, use the username root.

The password can be found in a file on your Linux server. Open the file with the following command and look for the Password field:

Code
sudo nano /etc/gitlab/initial_root_password
Code
# WARNING: This value is only valid under the following conditions

# 1. If it was set manually (either via the `GITLAB_ROOT_PASSWORD` environment variable or `gitlab_rails['initial_root_password']` setting in `gitlab.rb` before the first database population).

# 2. The password has not been manually changed, neither via UI nor command line.

#

# If the password shown here does not work, you must reset the admin password: https://docs.gitlab.com/ee/security/reset_user_password.html#reset-your-root-password.

Password: `[YOUR_PASSWORD_HERE]`

# NOTE: This file is automatically deleted 24 hours after the first reconfigure run.

Enter the username and password on the login page to access your GitLab dashboard for the first time. You should now have access to your GitLab panel on your own Linux server.

We strongly recommend creating a new user and/or changing the root user’s password. You can do this via Admin at the bottom left, then Overview -> Users. There you can manage all users of your GitLab instance.

Optional: Set Up Firewall with ufw

You can skip this step if you do not want to configure a firewall or if you already use firewalld on OpenSUSE, for example. Make sure ports 80/443 and 22 are open.

Install ufw

If ufw is already installed, you can skip this step.

bash
sudo apt-get install -y ufw
bash
sudo zypper install ufw

Open Required Ports

Code
sudo ufw allow http
sudo ufw allow https
sudo ufw allow OpenSSH

Enable Firewall

Warning

By default, ufw blocks all other ports except the allowed ones. Make sure your whitelist is correct before running this command.

Enable the firewall with:

Code
sudo ufw enable

Conclusion

Congratulations, you have successfully installed GitLab! If you have any questions or problems, our support team is available daily and happy to assist you!

If you want to make further configurations, we recommend reading the official GitLab documentation for the next steps.

FAQ

Frequently asked questions

You can install GitLab directly via One-Click Apps in the VPS web interface by searching for GitLab in the app catalog and starting deployment with your preferred project, environment, and domain settings.
Minimum requirements are 2x 2 GHz CPU, 4 GB RAM, 10 GB storage, and 100 Mbit/s bandwidth (up & down). Recommended are 4x 2.6+ GHz CPU, 8 GB RAM, and 50+ GB storage.
GitLab is a comprehensive DevOps platform that enables teams to collaborate on code, automate workflows, and efficiently manage the entire software development lifecycle.

Feedback

Was this article helpful?

Your feedback helps us prioritize and improve content.

0 of 0 Users found this article helpful.

Personal support

Need more help than the guide provides?

Our ZAP support team knows your product — briefly describe your issue and we'll help you personally.

Zappy knows this guide and answers you right in the chat.