How to Install and Configure GitLab on Ubuntu 24.04
Complete guide on how to install and configure GitLab on Ubuntu 24.04 LTS. Setup GitLab CE Omnibus package, SMTP email, and Let's Encrypt SSL.

7 min read
Complete guide on how to install and configure GitLab on Ubuntu 24.04 LTS. Setup GitLab CE Omnibus package, SMTP email, and Let's Encrypt SSL.
- Prerequisites and Supported Releases
- Step 1: Updating System and Installing Required Dependencies
- Step 2: Adding the Official GitLab Community Edition Repository
GitLab is a comprehensive, open-source DevOps platform delivered as a single application. Encompassing the entire software development lifecycle—from Git source code management and code review to automated CI/CD pipelines, container registries, vulnerability scanning, and issue tracking—GitLab provides a complete private alternative to GitHub.
For development teams and enterprises with strict data privacy, IP governance, or compliance mandates, self-hosting GitLab Community Edition (CE) on Ubuntu guarantees that source repositories and deployment credentials never leave your infrastructure. Learning how to install and configure gitlab on ubuntu 24.04 gives you a robust, scalable DevOps platform that deploys effortlessly via official Omnibus deb packages.
In this comprehensive step-by-step tutorial, we demonstrate how to install and configure GitLab Community Edition on Ubuntu 24.04 LTS (Noble Numbat). We cover installing prerequisites, configuring the official GitLab package repository, executing the automated Omnibus installer with Let's Encrypt SSL, retrieving initial root credentials, and configuring SMTP email notifications.
Install and configure GitLab Community Edition (CE) on Ubuntu 24.04 LTS using the official Omnibus package repository, automated Let's Encrypt SSL, and initial root password recovery.
Prerequisites and Supported Releases
This guide is thoroughly verified on Ubuntu 24.04 LTS (Noble Numbat). The instructions apply cleanly to cloud instances (AWS EC2, Google Compute Engine, DigitalOcean, Hetzner), bare-metal servers, and local virtual machines.
Before proceeding, ensure you have the following requirements satisfied:
- A dedicated server or cloud instance running
Ubuntu 24.04 LTS. - A non-root user with administrative
sudoprivileges. - A fully qualified domain name (e.g.,
gitlab.example.com) pointed to your server IP address. - At least
4 GB of RAM(8 GB strongly recommended for teams and GitLab CI/CD runner jobs).
Step 1: Updating System and Installing Required Dependencies
Before installing GitLab, update your local APT repository index and install the necessary system dependencies.
GitLab requires curl to download repository setup scripts, openssh-server for SSH Git transport, ca-certificates for TLS validation, and a mail transfer agent (such as Postfix) for sending notification emails.
Install the prerequisite packages using APT. During the Postfix installation dialog, select Internet Site when prompted for mail configuration, and specify your server's fully qualified domain name (such as gitlab.example.com) as the system mail name.
Verify that the SSH daemon is running and enabled to start automatically on system boot.
# Update repository indices and upgrade packages
sudo apt update && sudo apt upgrade -y
# Install prerequisite tools and Postfix for email alerts
sudo apt install -y curl openssh-server ca-certificates tzdata perl postfix
# Ensure SSH service is active
sudo systemctl enable --now ssh
Step 2: Adding the Official GitLab Community Edition Repository
The recommended method to install and maintain GitLab is using the official GitLab Omnibus repository.
The Omnibus package bundles all necessary components—including PostgreSQL, Redis, Puma, Nginx, and Workhorse—into a single, coordinated, pre-configured package maintained by GitLab Inc.
Download and run the official GitLab CE repository setup script. This script automatically detects your Ubuntu version (24.04 Noble Numbat), imports the official repository GPG signing key into /etc/apt/keyrings/, and creates the APT source list entry at /etc/apt/sources.list.d/gitlab_gitlab-ce.list.
Once the repository registration finishes, verify that local APT indices update successfully without signature warnings.
# Download and execute official GitLab CE repository script
curl -fsSL https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
# Refresh local package index
sudo apt update
Step 3: Installing GitLab CE with Automated Let's Encrypt SSL
Install the gitlab-ce package. You can supply your domain name directly to the installation command using the EXTERNAL_URL environment variable.
When you specify an https:// URL, the GitLab Omnibus installer automatically requests, validates, and installs a free Let's Encrypt SSL certificate during the initial Chef configuration run.
Under the hood, the installer initializes the embedded PostgreSQL relational database, seeds default database schemas, configures Redis queues, provisions Nginx HTTP/HTTPS vhosts, and starts the Puma Ruby application server.
Execute the installation command below with your actual domain name. The initial deployment typically takes between three to seven minutes depending on your CPU and disk I/O performance.
# Install GitLab CE and configure external domain with Let's Encrypt SSL
sudo EXTERNAL_URL="https://gitlab.example.com" apt install -y gitlab-ce
Step 4: Retrieving the Initial Administrator Root Password
During the automated installation process, GitLab generates a random initial administrative password for the root user account.
This password is saved to a protected temporary file at /etc/gitlab/initial_root_password.
Inspect the file to retrieve your initial credentials. Note that this file is automatically deleted by GitLab after 24 hours to enforce credential rotation.
Keep this terminal session open or store the temporary credentials in a password manager until you complete your initial administrative sign-in.
# View the initial root administrator password
sudo cat /etc/gitlab/initial_root_password
# The output contains: Password: <random_alphanumeric_string>
Step 5: Configuring the Firewall (UFW)
Configure Ubuntu's Uncomplicated Firewall (UFW) to permit inbound web and Git traffic.
GitLab requires port 80 (HTTP for Let's Encrypt challenge renewals and redirect), port 443 (HTTPS for encrypted web browsing and API calls), and port 22 (SSH for Git clone and push operations).
Open the necessary ports and verify firewall status to confirm that inbound connections are accepted.
# Allow HTTP, HTTPS, and SSH traffic
sudo ufw allow http
sudo ufw allow https
sudo ufw allow ssh
# Verify firewall rules
sudo ufw status numbered
Step 6: Logging into the GitLab Web Interface
Open your web browser and navigate to your configured domain: https://gitlab.example.com.
At the login screen, enter username root and paste the temporary password retrieved from /etc/gitlab/initial_root_password.
Click Sign In to open the main GitLab management console.
Once logged in, immediately navigate to your profile avatar > Edit profile > Password to set a permanent, secure administrator password. Furthermore, navigate to Two-Factor Authentication to enforce 2FA verification for root access.
Login URL: https://gitlab.example.com
Username: root
Password: <from /etc/gitlab/initial_root_password>
Step 7: Configuring SMTP Email Notifications in gitlab.rb
To allow GitLab to send password reset emails, pipeline failure alerts, mention notifications, and merge request updates, configure an external SMTP mail relay.
Open the master configuration file at /etc/gitlab/gitlab.rb with administrative privileges.
Configure the SMTP settings according to your mail provider (such as Amazon SES, SendGrid, Mailgun, or Google Workspace).
Apply the configuration changes by executing sudo gitlab-ctl reconfigure. You can then test email delivery directly from the command line using the GitLab Rails console.
# Edit /etc/gitlab/gitlab.rb
# sudo nano /etc/gitlab/gitlab.rb
# Sample SMTP configuration:
# gitlab_rails['smtp_enable'] = true
# gitlab_rails['smtp_address'] = "smtp.mailgun.org"
# gitlab_rails['smtp_port'] = 587
# gitlab_rails['smtp_user_name'] = "[email protected]"
# gitlab_rails['smtp_password'] = "secret_smtp_password"
# gitlab_rails['smtp_domain'] = "mg.example.com"
# gitlab_rails['smtp_authentication'] = "plain"
# gitlab_rails['smtp_enable_starttls_auto'] = true
# gitlab_rails['gitlab_email_from'] = '[email protected]'
# Reconfigure GitLab to apply settings
sudo gitlab-ctl reconfigure
# Test SMTP email delivery via Rails console
sudo gitlab-rails console
# Inside console run: Notify.test_email('[email protected]', 'Test Email', 'GitLab SMTP Test').deliver_now
Step 8: Managing the GitLab Instance and Creating Backups
The gitlab-ctl utility is your primary tool for managing services, viewing runtime health, and tailing logs across all bundled components.
You can inspect running daemons (Puma, PostgreSQL, Redis, Sidekiq, Nginx) using sudo gitlab-ctl status.
Create a full backup of all repositories, issues, database tables, and uploaded assets using the built-in backup tool. Backups are stored in /var/opt/gitlab/backups/ by default.
To automate daily backups, create a cron task in /etc/cron.d/gitlab-backup. Remember that the GitLab secrets file at /etc/gitlab/gitlab-secrets.json contains database encryption keys and must be backed up separately from repository tarballs.
# Check status of all GitLab services
sudo gitlab-ctl status
# Create complete instance backup
sudo gitlab-backup create
# View generated backup tarball in /var/opt/gitlab/backups/
ls -lh /var/opt/gitlab/backups/
# Schedule automated daily backup at 2 AM
echo "0 2 * * * root /opt/gitlab/bin/gitlab-backup create CRON=1" | sudo tee /etc/cron.d/gitlab-backup
Troubleshooting and Common Errors
When configuring Ubuntu servers, unexpected permission errors, network timeouts, or lock contention can occur. Review these common issues and verified resolutions:
Let's Encrypt certificate acquisition fails during installation
Resolution: Ensure that your domain name's DNS A record points directly to your server's public IP address before running the installation command. Confirm port 80 is open in your firewall for HTTP-01 challenge verification.
GitLab web interface returns 502 Whoops, GitLab is taking too much time to respond
Resolution: This indicates that the Puma web worker or PostgreSQL database is still booting up or the server is running out of memory. Ensure at least 4 GB of RAM plus 2 GB of swap space is configured, and run sudo gitlab-ctl status.
initial_root_password file missing
Resolution: If the initial password file has expired or was removed, you can reset the root password directly from the command line: sudo gitlab-rake 'gitlab:setup_initial_root_password[NewPassword123!]'.
Security Best Practices and Hardening
Change the root password immediately upon initial login, and enable Two-Factor Authentication (2FA) for all administrative accounts.
Disable open user registration in Admin Area > Settings > General > Sign-up restrictions if your GitLab instance is strictly for private internal teams.
Always backup /etc/gitlab/gitlab-secrets.json separately from repository backups; if secrets are lost, database encryption keys cannot be restored.
Keep GitLab updated promptly by applying monthly patch releases to protect against remote code execution vulnerabilities.
Related Ubuntu Tutorials and Documentation
Deepen your Linux system administration skills with our related production-tested guides:
Authoritative References and Official Documentation

The Linux Command Line, 2nd Edition: A Complete Introduction
Frequently Asked Questions
Quick answers to common questions and configurations
gitlab-runner package on the same server or on dedicated worker nodes to execute automated Docker or shell build pipelines.sudo apt update && sudo apt install gitlab-ce. The Omnibus package automatically handles database migrations and service restarts.Editorial Disclosure: Website Vidya is supported by our readers. When you purchase hosting, tools, or software through our verified partner links, we may earn an affiliate commission at no extra cost to you. We only recommend solutions we trust and rigorously verify.
Rajesh Ray
I’m Rajesh Rai, a full-stack developer, Linux administrator, and technology enthusiast passionate about making complex technology easier to understand and use.
Most Read Guides
TrendingUbuntu Server Not Booting? 10 Simple Steps to Fix It Fast
How to Create a 3D Button in HTML and CSS: Easy Steps
How to Install Python and Pip on Ubuntu 24.04 LTS
How to Install Nginx on Ubuntu 24.04
How to Install Python on Ubuntu 24.04 LTS
Related Technical Guides
Tested runbooks, server administration walkthroughs, and troubleshooting guides


Join the Conversation & Perspective
Have thoughts, counterpoints, or reflections on this story? Engage directly with fellow readers and editorial contributors.
No comments on this guide yet. Be the first to share your thoughts or ask a question!