FedoraRHEL Based

How To Install GitLab on Fedora 42

Install GitLab on Fedora 42

GitLab has become an essential platform for modern software development teams, offering comprehensive repository management, continuous integration, and DevOps capabilities all in one integrated solution. For Fedora users, hosting your own GitLab instance provides greater control over your development infrastructure while maintaining security and privacy. This guide will walk you through the complete process of installing and configuring GitLab Community Edition on Fedora 42.

Introduction

GitLab represents one of the most powerful open-source DevOps platforms available today, combining code repository management with robust CI/CD pipelines, issue tracking, and collaboration tools. While GitLab offers cloud-hosted options, self-hosting provides complete control over your data and configuration while avoiding subscription costs for teams exceeding the free tier limitations.

Fedora 42, as a cutting-edge Linux distribution, offers an excellent foundation for your GitLab server with its strong security features and up-to-date software packages. This combination creates a powerful, flexible environment for development teams of any size.

This comprehensive guide targets system administrators, DevOps engineers, and developers looking to establish their own GitLab instance. We’ll cover everything from initial preparation to advanced configuration options, ensuring you have a production-ready GitLab deployment.

Prerequisites

Before beginning the GitLab installation process, you’ll need to ensure your system meets several important requirements to support smooth operation.

System Requirements

GitLab performance depends heavily on available system resources. For a small team installation, you should have at minimum:

  • 4 CPU cores (2 cores minimum, but performance will suffer)
  • 8GB RAM (4GB absolute minimum)
  • 50GB storage space (preferably SSD for optimal performance)
  • Additional storage planning: allocate at least as much free space as the total size of all repositories you expect to host

Your CPU and RAM configuration affects the number of Puma workers and threads GitLab can utilize, which directly impacts performance under load. For production environments with more than 100 users, consider scaling these resources accordingly.

Software Requirements

To ensure a trouble-free installation:

  • A clean, updated Fedora 42 installation
  • Root or sudo privileges on the target system
  • Command line access via SSH or direct terminal
  • Stable internet connection for package downloads
  • No competing web services on ports 80/443

Domain Configuration

While GitLab can operate with just an IP address, a proper domain setup enhances functionality:

  • Registered domain name pointing to your server (recommended for production)
  • Proper DNS configuration with A or AAAA records
  • Alternatively, local hostname configuration for testing environments

Planning these details before installation will save significant troubleshooting time later and ensure your GitLab instance launches smoothly.

Preparing Your Fedora 42 System

A properly prepared system forms the foundation for a stable GitLab installation. These preparatory steps ensure all dependencies are available and configured correctly.

System Updates

Always begin with a fully updated system:

sudo dnf clean all
sudo dnf update -y

This process refreshes the package cache and applies all available updates, ensuring compatibility with the latest GitLab packages and security patches.

Essential Dependencies Installation

GitLab requires several core dependencies to function properly:

sudo dnf install -y curl policycoreutils openssh-server perl

Each package serves a specific purpose in the GitLab ecosystem:

  • curl: Handles HTTP requests for the installation process
  • policycoreutils: Manages SELinux policies (critical on Fedora systems)
  • openssh-server: Enables Git operations over SSH
  • perl: Required for GitLab’s various automation scripts

Mail Service Configuration

GitLab relies on email for notifications, user registration, and password resets:

sudo dnf install -y postfix
sudo systemctl enable postfix
sudo systemctl start postfix

For basic operation, the default Postfix configuration works, but production environments should consider proper mail server configuration to improve email deliverability. After installation, verify the service is running:

sudo systemctl status postfix

A properly configured mail service prevents user management headaches later in your GitLab deployment process.

Adding the GitLab Repository

Since GitLab isn’t available in the default Fedora repositories, we need to add the official GitLab repository to install and receive updates.

Repository Configuration

Create a new repository file using your preferred text editor:

sudo nano /etc/yum.repos.d/gitlab-ce.repo

Add the following configuration to the file:

[gitlab-ce]
name=GitLab CE Repository
baseurl=https://packages.gitlab.com/gitlab/gitlab-ce/el/9/$basearch
gpgcheck=1
enabled=1
gpgkey=https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey
       https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey/gitlab-gitlab-ce-3D645A26AB9FBD22.pub.gpg

Save and close the file. This configuration adds the official GitLab Community Edition repository to your system.

Repository Compatibility

Note that we’re using the Enterprise Linux (EL) repository since GitLab doesn’t provide Fedora-specific packages. This approach works because Fedora and RHEL share compatible package formats. For Fedora 42, the EL8 repository provides the best compatibility.

If you encounter compatibility issues, you may also try the EL9 repository by changing the baseurl line to reference el/9/ instead of el/8/.

Installing GitLab Community Edition

With the repository properly configured, you can now install the GitLab Community Edition package.

Installation Command

Execute the following command to install GitLab:

sudo dnf install gitlab-ce -y

This command initiates the installation process, which might take several minutes depending on your system and internet connection speed. The installer will download and configure all required components.

Installation Process

During installation, the package manager:

  • Resolves and installs all dependencies
  • Unpacks the GitLab application files
  • Creates necessary system users and permissions
  • Prepares initial configuration files

The process is largely automated, but watch for any error messages that might indicate problems.

Verification Steps

After the package installation completes, verify that all components were installed correctly:

rpm -qa | grep gitlab

This command should display the installed GitLab package. If nothing appears, the installation may have failed, and you should check system logs for errors:

sudo journalctl -xe

Common installation errors typically involve dependency conflicts or insufficient disk space, which can be resolved by updating packages or freeing space as needed.

Initial GitLab Configuration

After successful installation, GitLab requires initial configuration before it’s ready for use.

Configuration File Overview

The main GitLab configuration file is located at /etc/gitlab/gitlab.rb. This Ruby file contains all settings that control GitLab’s behavior. While it has hundreds of options, most installations only need to modify a few key settings.

External URL Configuration

The most critical initial setting is the external URL which tells GitLab how users will access the system:

sudo nano /etc/gitlab/gitlab.rb

Find and modify the external_url line:

external_url 'http://gitlab.example.com'

Replace gitlab.example.com with your actual domain name or server IP address. For local testing, you might use something like http://gitlab.local or even http://localhost.

Reconfiguring GitLab

After making changes to the configuration file, reconfigure GitLab to apply them:

sudo gitlab-ctl reconfigure

This command runs Chef to configure all GitLab components according to your settings. The process may take several minutes and produces detailed output as various services are configured.

Initial Root Password

During first-time setup, GitLab generates a random password for the root user, stored in:

sudo cat /etc/gitlab/initial_root_password

This password is valid for 24 hours after installation. Make sure to save it securely and change it promptly through the web interface.

Securing GitLab with HTTPS

For production environments, securing your GitLab instance with HTTPS is essential to protect sensitive data and credentials.

SSL Options Overview

GitLab supports several methods for HTTPS configuration:

  • Let’s Encrypt: Automated, free certificates
  • Self-signed certificates: Quick setup but triggers browser warnings
  • Custom certificates: Using certificates from your own certificate authority

Self-signed Certificate Setup

For testing or internal deployments, self-signed certificates provide basic encryption:

  1. Create the certificates directory:
    sudo mkdir -p /etc/gitlab/ssl
    sudo chmod 755 /etc/gitlab/ssl
  2. Generate a self-signed certificate (replace gitlab.example.com with your domain):
    sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
      -keyout /etc/gitlab/ssl/gitlab.example.com.key \
      -out /etc/gitlab/ssl/gitlab.example.com.crt
  3. Update GitLab configuration:
    sudo nano /etc/gitlab/gitlab.rb
  4. Modify the external URL to use HTTPS:
    external_url 'https://gitlab.example.com'
    letsencrypt['enable'] = false
  5. Apply the configuration:
    sudo gitlab-ctl reconfigure

Let’s Encrypt Configuration

For public-facing instances, Let’s Encrypt provides free trusted certificates:

  1. Update GitLab configuration:
    sudo nano /etc/gitlab/gitlab.rb
  2. Add the following settings:
    external_url 'https://gitlab.example.com'
    letsencrypt['enable'] = true
    letsencrypt['contact_emails'] = ['admin@example.com'] # Your email address
  3. Apply the configuration:
    sudo gitlab-ctl reconfigure

GitLab will automatically obtain and renew certificates as needed.

Firewall Configuration

Configuring your firewall correctly ensures GitLab is accessible while maintaining system security.

Required Ports

GitLab requires several ports to be accessible:

  • HTTP (80): Required for web access and Let’s Encrypt verification
  • HTTPS (443): Secure web access
  • SSH (22): Git operations over SSH

Firewall Commands

Configure the firewall with the following commands:

sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --permanent --add-service=ssh
sudo firewall-cmd --reload

These commands permanently enable access to the necessary services and apply the changes immediately.

Verification Steps

Verify the firewall configuration:

sudo firewall-cmd --list-all

This command displays all allowed services and ports. Ensure http, https, and ssh appear in the services list.

Accessing and Configuring GitLab

With installation and basic configuration complete, you can now access and configure your GitLab instance.

First Login

Access GitLab through your web browser by navigating to the URL you configured (e.g., https://gitlab.example.com).

On first access:

  1. Enter root as the username
  2. Use the password from /etc/gitlab/initial_root_password
  3. You’ll be directed to the GitLab dashboard after successful login

Install GitLab on Fedora 42

Basic Administration

After logging in, perform these essential administrative tasks:

  1. Change the root password:
    • Click on the user avatar in the top-right corner
    • Select “Preferences”
    • Navigate to “Password”
    • Set a strong new password
  2. Configure two-factor authentication for enhanced security:
    • In user preferences, select “Account”
    • Find the “Two-factor Authentication” section and follow the setup process
  3. Create your first project:
    • Click the “New project” button on the dashboard
    • Choose between creating a blank project, importing from another repository, or using templates

User Management

For team environments, creating additional users with appropriate permissions is crucial:

  1. Navigate to “Admin Area” (wrench icon)
  2. Select “Users” from the sidebar
  3. Click “New user” to create accounts
  4. Assign appropriate roles and permissions based on team responsibilities

Regular users can be given different access levels (Guest, Reporter, Developer, Maintainer, Owner) to control their permissions within projects and groups.

Optimizing GitLab Performance

Optimizing performance ensures smooth operation as your GitLab instance grows.

Worker Configuration

Adjust Puma workers based on available CPU cores:

sudo nano /etc/gitlab/gitlab.rb

Add or modify these settings:

puma['worker_processes'] = 4  # Set to number of CPU cores
puma['max_threads'] = 4       # Increase for more concurrent connections

These settings optimize the application server performance based on your hardware capabilities.

Memory Management

GitLab’s components can be memory-intensive. Optimize memory allocation:

# Decrease PostgreSQL shared buffers on systems with limited RAM
postgresql['shared_buffers'] = "256MB"  # Default is 25% of available RAM

# Redis memory settings
redis['maxmemory'] = "512mb"
redis['maxmemory_policy'] = "allkeys-lru"

Monitor memory usage after applying these changes to ensure stability.

Storage Optimization

Configure GitLab’s storage settings for better performance:

# Store Git data on a separate volume if available
git_data_dirs({
  "default" => {
    "path" => "/mnt/gitlab/git-data"
  }
})

# Configure backup path
gitlab_rails['backup_path'] = "/mnt/gitlab/backups"

Using separate high-performance storage volumes for Git data can significantly improve performance for large repositories.

Common Troubleshooting

Even with careful installation, issues can arise. Here are solutions to common problems.

Installation Issues

If GitLab fails to install:

  • Check package dependencies: sudo dnf deplist gitlab-ce
  • Verify repository configuration: sudo dnf repolist | grep gitlab
  • Ensure sufficient disk space: df -h

SELinux can sometimes interfere with GitLab operations. If you suspect SELinux issues:

sudo cat /var/log/audit/audit.log | grep gitlab

You might need to create custom SELinux policies or temporarily set SELinux to permissive mode for testing:

sudo setenforce 0  # Temporary until reboot

Configuration Problems

If gitlab-ctl reconfigure fails:

  • Check configuration syntax: sudo gitlab-ctl chef-client --help
  • Review logs: sudo gitlab-ctl tail
  • Examine specific service logs: sudo gitlab-ctl tail nginx

When services fail to start:

sudo gitlab-ctl status
sudo gitlab-ctl restart failing-service

Connection Problems

If you cannot access the GitLab web interface:

  • Verify the service is running: sudo gitlab-ctl status
  • Check NGINX configuration: sudo gitlab-ctl tail nginx
  • Test local access: curl -I http://localhost
  • Verify firewall settings: sudo firewall-cmd --list-all

For SSL certificate issues:

  • Verify certificate paths in /etc/gitlab/gitlab.rb
  • Check certificate validity: openssl verify /etc/gitlab/ssl/gitlab.example.com.crt
  • Review NGINX SSL logs: sudo gitlab-ctl tail nginx/error.log

Advanced Configuration Options

Once your basic installation is working, consider these advanced configurations.

Backup and Restore

Configure automated backups to protect your data:

sudo nano /etc/gitlab/gitlab.rb

Add the following settings:

gitlab_rails['backup_keep_time'] = 604800  # Keep backups for 7 days
gitlab_rails['backup_path'] = "/var/opt/gitlab/backups"

Create a backup manually:

sudo gitlab-rake gitlab:backup:create

Schedule regular backups using cron:

sudo crontab -e
# Add line:
0 2 * * * /opt/gitlab/bin/gitlab-rake gitlab:backup:create CRON=1

Email Integration

Configure a proper email service for notifications:

gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.example.com"
gitlab_rails['smtp_port'] = 587
gitlab_rails['smtp_user_name'] = "gitlab@example.com"
gitlab_rails['smtp_password'] = "secure-password"
gitlab_rails['smtp_domain'] = "example.com"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['gitlab_email_from'] = 'gitlab@example.com'

Apply the configuration with sudo gitlab-ctl reconfigure and test email delivery:

sudo gitlab-rake gitlab:check SANITIZE=true

CI/CD Runners

GitLab CI/CD requires runners to execute jobs. Install a runner on the same server or separate machines:

# Install the runner package
sudo dnf install gitlab-runner

# Register the runner with your GitLab instance
sudo gitlab-runner register

During registration, you’ll need:

  • GitLab instance URL
  • Registration token (found in Admin Area > Runners)
  • Runner description and tags
  • Executor type (shell, Docker, etc.)

Regular Maintenance Tasks

Establishing a maintenance routine ensures long-term stability and security.

Updates and Upgrades

Keep GitLab updated regularly:

# Update package list
sudo dnf check-update

# Backup before upgrading
sudo gitlab-rake gitlab:backup:create

# Update GitLab
sudo dnf update gitlab-ce -y

# Reconfigure and restart
sudo gitlab-ctl reconfigure
sudo gitlab-ctl restart

Always review the version-specific upgrade notes on the official GitLab documentation before major version upgrades.

Backup Verification

Regularly test your backup restoration process:

# Create a test environment
# Restore a backup to verify integrity
sudo gitlab-rake gitlab:backup:restore BACKUP=timestamp_of_backup

Verification in a test environment prevents surprises when real recovery is needed.

Health Checks

Monitor system health regularly:

# Check GitLab components
sudo gitlab-rake gitlab:check

# Monitor system resource usage
sudo dnf install htop iotop
sudo htop

# Review GitLab logs
sudo gitlab-ctl tail

Setting up monitoring tools like Prometheus and Grafana (which can integrate with GitLab) provides deeper insights into system performance and potential issues.

Congratulations! You have successfully installed GitLab. Thanks for using this tutorial for installing GitLab on Fedora 42 Linux system. For additional help or useful information, we recommend you check the official GitLab website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button