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

28 November 20269 min read32 Views0 helpful

Introduction

GitLab is a comprehensive DevOps platform that enables teams to work together on code, automate workflows, and efficiently manage the entire software development lifecycle. In this guide, we’ll show you two ways to get started: the easy way, using the One-Click App to make GitLab available over HTTPS in just a few clicks, and a manual installation from the official package repositories using the console.

The easy way: GitLab as a One-Click App

The quickest way to get your own GitLab instance is through the One-Click Apps on your VPS. ZapX launches GitLab Community Edition as a container, sets up a domain and HTTPS for you, and generates the password for the admin account. You don’t need to install packages or edit gitlab.rb.

Requirements

  • A Linux VPS (Debian or Ubuntu) with One-Click Apps set up. See Set Up One-Click Apps to learn how.
  • Enough memory: GitLab is resource-intensive. According to the GitLab documentation, a single installation can run in constrained environments with 8 GB RAM, while GitLab recommends 16 GB RAM and 8 CPU cores as a starting point. Even when idle, GitLab uses around 3.5 GB.
  • Only one GitLab installation is possible per VPS because Git uses port 2222 for SSH.

Install

  1. Open your VPS in the ZapX dashboard and go to the One-Click Apps tab.
  2. Search for GitLab in the App catalog and click Install app.
  3. Leave Use a custom subdomain or zap.cloud enabled and choose an address. You’ll be able to access GitLab over HTTPS at this address.
  4. You don’t need to enter anything under App configuration. However, change the time zone: enter your time zone in TZ and GITLAB_TIMEZONE, for example, Europe/Berlin. The default value is UTC. You only need the GITLAB_SMTP_* fields if GitLab should send emails; see below.
  5. Click Queue installation. GitLab takes several minutes to start for the first time, even if the app is already shown as online. Until it’s ready, the address will display an error.

First login

Open the app’s Access link and sign in with the user root. You can find the password in the app settings (gear icon), under App environment > Automatically generated values, as SERVICE_PASSWORD_GITLAB. Click the eye icon to show it or the copy icon to copy it.

The password is for the first startup. If you change it afterward in GitLab under your profile, your new password will remain in effect.

Disable registration

By default, anyone who knows the address can create an account in your GitLab. GitLab itself points this out in the Admin area. In the notice “Check the restrictions for new users,” click “Deactivate” if you want only you and your team to have accounts. You can then create new users in the Admin area under “Users.”

Use Git over SSH

You can clone and push over HTTPS right away using the app’s address. To use Git over SSH, the One-Click App uses port 2222; you can find the connection details in the panel on the app card under Connection. First, add your public SSH key to GitLab under “SSH Keys” in your profile. GitLab displays your project’s SSH addresses with the correct port, for example:

Code
git clone ssh://git@name-1234.zap.cloud:2222/group/project.git

Set up email delivery

Without a mail server, GitLab won’t send emails, including notifications or password reset links. To set this up, enter your email provider’s details in the app settings (gear icon), under App environment:

VariableValue
GITLAB_SMTP_ENABLEtrue
GITLAB_SMTP_ADDRESSSMTP server address
GITLAB_SMTP_PORTPort, usually 587
GITLAB_SMTP_USER_NAMEMailbox username
GITLAB_SMTP_PASSWORDMailbox password
GITLAB_SMTP_DOMAINYour email provider’s domain
GITLAB_EMAIL_FROMSender address, for example, gitlab@your-domain.de

Then click Save. The app will restart.

Updates

To check whether an update is available for your installation, go to the app settings (gear icon), select App update, and click Check for updates. If a new version is available, install it by clicking Apply update. Repositories, settings, and the database are stored in separate volumes and will be preserved.

Warning: Apply major version upgrades in stages

GitLab requires specific intermediate versions for major upgrades. Keep your installation up to date regularly and check GitLab’s upgrade planning before updating.

Manual installation

The rest of this guide describes how to manually install GitLab from the official package repositories using the console. For example, you might choose this method if you want to run GitLab directly on the server instead of in a container, or if you want to control each step yourself.

Preparation

The following requirements are recommended by the official GitLab team. We strongly recommend meeting these requirements to avoid problems and inconveniences later.

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+
OtherRedis 7.x+, Sidekiq 7.3.2+, Prometheus 2.54.1+
Info

For the latest and most accurate specifications, please refer to GitLab’s official Hardware Requirements documentation.

To install GitLab on your Linux server, you’ll need to connect using an SSH client. See our Initial Access (SSH) guide for instructions.

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

Step 1: Install dependencies

First, 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 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 tzdata perl

You can optionally install Postfix (SMTP server) if you want to send email notifications through 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

You can optionally install Postfix (SMTP server) if you want to send email notifications through 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, make sure the required ports are open.

Check whether firewalld is active with:

bash
sudo systemctl status firewalld

If it is, open the default ports (80 and 443):

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

You can optionally install Postfix (SMTP server) if you want to send email notifications through 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

A configuration screen may appear during the Postfix installation. Select “Internet Site” and press Enter to confirm. For the “mail name,” enter the external DNS name of your Linux server and confirm. If additional screens appear, press Enter on each one to accept the default values. If you want to use another email delivery solution, skip this step and configure an external SMTP server after installing GitLab, following the official instructions.

Step 2: Install GitLab

Once all dependencies are installed, you can install GitLab.

In this guide, we’ll 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

You can then 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

You can then install the gitlab-ee package:

bash
sudo zypper install gitlab-ee

Once this process is complete, GitLab should be ready to use on your Linux server. In the next section, you’ll configure important settings to ensure the server runs smoothly.

Step 3: Configure GitLab

For everything to work, you’ll need to make some changes to the configuration file. Open the GitLab configuration file with your preferred text editor. In this example, we’ll use the preinstalled nano editor.

Code
sudo nano /etc/gitlab/gitlab.rb

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

Code
## GitLab URL
##! URL, under which 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 value of the environment variable
##! EXTERNAL_URL is used to set/replace this value.
##! For AWS EC2 instances, an attempt is made 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 / IPv4 address of your Linux server`'

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

Info

You need a domain to get a free SSL certificate from Let's Encrypt. You can’t request a certificate directly for an IP address.

Code
################################################################################
# Let's Encrypt Integration
################################################################################
# letsencrypt['enable'] = nil
# letsencrypt['contact_emails'] = [`Your email here`] # 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

Press CTRL+W to search for letsencrypt['contact_emails'], then press Enter so you don’t have to search through the entire file manually.

When you’re done, press CTRL+X, then Y and Enter to save your 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 you used a domain, SSL certificates will also be issued automatically.

Step 4: Access the web interface

After initialization, you should be able to access the server in a web browser. Open your site by entering your domain or IP address:

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

The login page will appear the first time you access it.

Use the root user for your first login.

You can find the password 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 the `gitlab_rails['initial_root_password']` setting in `gitlab.rb` before the initial database population).

# 2. The password has not been changed manually, either via the UI or the command line.

#

# If the password shown here does not work, you’ll need to 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 your 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 password for the root user. You can do this by clicking Admin in the bottom left, then Overview -> Users. From there, you can manage all users on your GitLab instance.

Optional: Set up the firewall with ufw

You can skip this step if you don’t want to configure a firewall or, for example, if you’re already using firewalld on OpenSUSE. 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 the required ports

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

Enable the firewall

Warning

By default, ufw will block all other ports except those you’ve allowed. Make sure your whitelist is correct before running this command.

Enable the firewall with:

Code
sudo ufw enable

Conclusion

Congratulations, you’ve successfully installed GitLab! If you have any questions or run into problems, our support team is available every day and will be happy to help.

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

Free tools

Related tools for servers and developers

View all

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 people found this article helpful.

Personal support

Need more help than the guide provides?

Our ZAP-Hosting 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.