Installing a single-node GitLab instance on RHEL/CentOS

Installing a single-node GitLab instance on RHEL/CentOS

 

Prerequisites

  • Operating System: RHEL 7+ or CentOS 7+ (64-bit)
  • System Requirements:
  • CPU: 2 cores minimum
  • RAM: 4 GB minimum (8 GB recommended)
  • Disk Space: At least 10 GB free
  • Root Access: Ensure you have root or sudo privileges
  • Domain Name: A fully qualified domain name (FQDN) pointing to your server’s IP address is recommended for production environments

Step-by-Step Installation

1. Update Your System

sudo yum update -y

2. Install Required Dependencies

sudo yum install -y curl policycoreutils-python openssh-server openssh-clients postfix

3. Enable and Start Services

sudo systemctl enable sshd
sudo systemctl start sshd

sudo systemctl enable postfix
sudo systemctl start postfix

4. Configure Firewall

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

5. Add GitLab Repository

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

6. Install GitLab CE

sudo yum install -y gitlab-ce

7. Configure GitLab

Set the external URL for GitLab:

sudo nano /etc/gitlab/gitlab.rb

Locate the line:

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

Replace 'http://gitlab.example.com' with your server’s FQDN or IP address, e.g., 'http://yourdomain.com'. Save and exit the editor.

8. Reconfigure GitLab

Apply the configuration changes:

sudo gitlab-ctl reconfigure

Optional: Enable HTTPS with Let’s Encrypt

To secure your GitLab instance with HTTPS:

  1. Edit GitLab Configuration:
   sudo nano /etc/gitlab/gitlab.rb

  1. Modify the External URL:
   external_url 'https://yourdomain.com'

  1. Enable Let’s Encrypt:
   letsencrypt['enable'] = true
   letsencrypt['contact_emails'] = ['[email protected]'] # Replace with your email

  1. Reconfigure GitLab:
   sudo gitlab-ctl reconfigure

Note: Ensure that ports 80 and 443 are open and that your domain’s DNS records point to your server’s IP address.


Accessing GitLab

Open your web browser and navigate to your GitLab instance:

  • Without HTTPShttp://yourdomain.com
  • With HTTPShttps://yourdomain.com

On first access:

  1. Set the Password: You’ll be prompted to set a password for the root user.
  2. Login: Use the username root and the password you just set.([docs.gitlab.com][3])

Post-Installation Tips

  • Change the Default Username: After logging in, consider changing the root username for security purposes.
  • Add SSH Keys: To interact with repositories via SSH, add your public SSH key to your GitLab profile.
  • Configure Backups: Set up regular backups to prevent data loss.
  • Monitor Performance: Utilize GitLab’s built-in monitoring tools to keep an eye on system performance.

For more detailed information and advanced configurations, refer to the official GitLab documentation

If you need assistance with setting up GitLab Runner, integrating CI/CD pipelines, or configuring email notifications, reach out to us for support.


Posts Carousel

Leave a Comment

Your email address will not be published. Required fields are marked with *

Latest Posts

Most Commented

Featured Videos