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.
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.
The following requirements are recommended by the official GitLab Team. It is highly advisable to meet these prerequisites to avoid future issues and inconveniences.
| Components | Minimum | Recommended |
|---|---|---|
| CPU | 2x 2 GHz | 4x 2.6+ GHz |
| RAM | 4 GB | 8 GB |
| Storage | 10 GB | 50+ GB |
| Bandwidth | 100 Mbit/s (Up & Down) | 100 Mbit/s (Up & Down) |
| Platform | Options |
|---|---|
| Operating System | Ubuntu (20.04, 22.04, 24.04), Debian (10, 11, 12), OpenSUSE (15.5) |
| Database | PostgreSQL 14.9+ |
| Web Server | NGINX (bundled with GitLab), Puma 6.4.2+ |
| Others | Redis 7.x+, Sidekiq 7.3.2+, Prometheus 2.54.1+ |
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.
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.
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:
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.
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:
sudo apt-get install -y postfix
Install the OpenSSH server and required prerequisites with the following command. This will host your GitLab web interface.
sudo zypper install curl openssh perl
Make sure the OpenSSH daemon is enabled:
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:
sudo systemctl status firewalld
If yes, open the standard ports (80 and 443):
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:
sudo zypper install postfix
sudo systemctl enable postfix
sudo systemctl start postfix
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.
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:
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.deb.sh | sudo bash
Then you can install the gitlab-ee package:
sudo apt-get install -y gitlab-ee
The following script adds the GitLab repositories to the Zypper package manager:
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh | sudo bash
Then you can install the gitlab-ee package:
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.
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.
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.
## 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.
For a free SSL certificate from Let's Encrypt, you need a domain. You cannot request a certificate directly for an IP address.
################################################################################
# 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'] = []
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:
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.
After initialization, the server should now be accessible via a web browser. Open your site by entering your domain or IP address:
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:
sudo nano /etc/gitlab/initial_root_password
# 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.
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.
If ufw is already installed, you can skip this step.
sudo apt-get install -y ufw
sudo zypper install ufw
sudo ufw allow http
sudo ufw allow https
sudo ufw allow OpenSSH
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:
sudo ufw enable
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.