GitLab Community Edition is a full-featured, self-hosted DevOps platform combining Git repository management, issue tracking, CI/CD pipelines, and a container registry in a single application. Running GitLab CE on RHEL 8 gives you complete control over your source code and pipeline infrastructure without relying on third-party SaaS providers. This tutorial covers installing GitLab CE from the official package repository, running the initial configuration, opening the necessary firewall ports, and logging in as the root administrator for the first time.
Prerequisites
- A RHEL 8 server with at least 4 GB RAM (8 GB recommended for production)
- At least 20 GB of free disk space
- A fully qualified domain name (FQDN) or a static IP address for the
EXTERNAL_URL - Root or sudo access
- Ports 22, 80, and 443 reachable from client machines
Step 1 — Install Required Dependencies
GitLab’s installation script requires curl to fetch the repository setup script. OpenSSH server handles Git-over-SSH operations and Postfix handles outbound email notifications.
sudo dnf install -y curl openssh-server postfix perl
sudo systemctl enable --now sshd
sudo systemctl enable --now postfix
If your environment uses an external SMTP relay you can skip the Postfix setup and configure GitLab to use that relay later via /etc/gitlab/gitlab.rb.
Step 2 — Add the GitLab CE Repository
GitLab provides an official repository setup script that configures the correct dnf repo, imports the GPG key, and verifies the package source.
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
sudo dnf makecache
The script detects the OS and version automatically, creating a file at /etc/yum.repos.d/gitlab_gitlab-ce.repo. You can inspect it to confirm the baseurl points to the correct repository before proceeding.
Step 3 — Install GitLab CE
Set the EXTERNAL_URL environment variable to the URL clients will use to reach GitLab. This is baked into the configuration during installation.
sudo EXTERNAL_URL="http://gitlab.example.com" dnf install -y gitlab-ce
Replace gitlab.example.com with your actual domain or IP address. For TLS, use https:// — GitLab will automatically provision a Let’s Encrypt certificate if the server is publicly reachable. The initial installation takes several minutes as it compiles assets and sets up internal services.
Step 4 — Run gitlab-ctl reconfigure
After installation, run reconfigure to apply the configuration, initialize the database, and start all GitLab internal services (Puma, Sidekiq, PostgreSQL, Redis, Nginx).
sudo gitlab-ctl reconfigure
sudo gitlab-ctl status
All services listed by status should show run: rather than down:. If a service is down, check its log with sudo gitlab-ctl tail <service-name>. The reconfigure command is idempotent — you can safely re-run it after editing /etc/gitlab/gitlab.rb.
Step 5 — Open Firewall Ports
GitLab needs HTTP (80), HTTPS (443), and SSH (22) to be reachable. Open these ports in firewalld and make the rules permanent.
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
sudo firewall-cmd --list-all
If SSH is already open from the original server configuration it will not be duplicated. For environments where port 22 is reserved for server administration you can configure GitLab to use an alternate SSH port by setting gitlab_rails['gitlab_shell_ssh_port'] in /etc/gitlab/gitlab.rb.
Step 6 — Log In and Change the Root Password
GitLab generates a temporary root password during reconfigure. Retrieve it and log in to change it immediately, as the file is deleted after 24 hours.
sudo cat /etc/gitlab/initial_root_password
Open http://gitlab.example.com in your browser. Log in with username root and the password from the file above. Once logged in, navigate to User Settings → Password and set a strong permanent password. After changing the password, remove the temporary file manually for security.
sudo rm -f /etc/gitlab/initial_root_password
Conclusion
You have installed GitLab CE on RHEL 8, configured the external URL, opened the required firewall ports, and completed the first login with the generated root password. GitLab is now ready to host Git repositories and serve as the foundation for a full self-hosted CI/CD platform. Create your first project by clicking New Project from the GitLab dashboard and push your code using the repository URL displayed on the project’s home page. Keep GitLab updated with sudo dnf update gitlab-ce and monitor disk usage as repositories and CI artifacts grow over time.
Next steps: How to Configure GitLab CI/CD Pipelines on RHEL 8, How to Install Jenkins on RHEL 8, and How to Set Up a Git Server with Gitea on RHEL 8.