Gitea is a lightweight, self-hosted Git service written in Go that provides GitHub-like functionality (repositories, issues, pull requests, wikis, webhooks, and CI/CD via Gitea Actions) in a single binary consuming under 100 MB of RAM. Compared to GitLab CE (which requires 4–8 GB RAM and a complex Omnibus bundle), Gitea is ideal for small teams, Raspberry Pi servers, edge deployments, and any environment where resource efficiency matters more than enterprise features. Gitea stores data in SQLite (for single-user/small installs) or PostgreSQL/MySQL (for larger teams), and its web interface is familiar to GitHub users. This guide covers installing Gitea on RHEL 9 as a systemd service with PostgreSQL and Nginx reverse proxy, and configuring SSH and HTTP access for Git operations.

Prerequisites

  • RHEL 9 with 512 MB RAM minimum (1 GB recommended)

Step 1 — Install PostgreSQL and Create Database

dnf install -y postgresql postgresql-server
postgresql-setup --initdb
systemctl enable --now postgresql
sudo -u postgres psql <<'EOF'
CREATE USER gitea WITH PASSWORD 'GiteaPass123!';
CREATE DATABASE gitea OWNER gitea;
q
EOF

Step 2 — Install Gitea

# Create a dedicated system user
useradd --system --shell /bin/bash --create-home --home-dir /var/lib/gitea gitea

# Download the latest Gitea binary
GITEA_VERSION=1.22.3
curl -fsSL "https://dl.gitea.com/gitea/${GITEA_VERSION}/gitea-${GITEA_VERSION}-linux-amd64" 
    -o /usr/local/bin/gitea
chmod +x /usr/local/bin/gitea

# Create required directories
mkdir -p /var/lib/gitea/{custom,data,log}
chown -R gitea:gitea /var/lib/gitea
mkdir -p /etc/gitea
chown root:gitea /etc/gitea
chmod 770 /etc/gitea

Step 3 — Configure systemd Service

# /etc/systemd/system/gitea.service
[Unit]
Description=Gitea — A lightweight self-hosted Git service
After=network.target postgresql.service

[Service]
Type=notify
User=gitea
Group=gitea
WorkingDirectory=/var/lib/gitea/
RuntimeDirectory=gitea
ExecStart=/usr/local/bin/gitea web --config /etc/gitea/app.ini
Restart=always
Environment=USER=gitea HOME=/var/lib/gitea GITEA_WORK_DIR=/var/lib/gitea

[Install]
WantedBy=multi-user.target
systemctl daemon-reload
systemctl enable --now gitea
systemctl status gitea

Step 4 — Complete Web Installer

# Open the firewall and access the installer
firewall-cmd --permanent --add-port=3000/tcp
firewall-cmd --reload

# Access: http://your-server-ip:3000
# In the installer:
# - Database type: PostgreSQL
# - Host: 127.0.0.1:5432 | Database: gitea | User: gitea | Password: GiteaPass123!
# - Site title, base URL, and admin account

Step 5 — Configure Nginx Reverse Proxy

# /etc/nginx/conf.d/gitea.conf
server {
    listen 80;
    server_name git.example.com;
    return 301 https://$host$request_uri;
}
server {
    listen 443 ssl;
    server_name git.example.com;
    ssl_certificate /etc/nginx/ssl/gitea.crt;
    ssl_certificate_key /etc/nginx/ssl/gitea.key;

    location / {
        proxy_pass http://127.0.0.1:3000;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

Conclusion

Gitea on RHEL 9 delivers a full-featured Git hosting platform in a minimal footprint — ideal for teams that want GitHub-style collaboration without the resource requirements of GitLab. Gitea’s single binary architecture means upgrades are as simple as replacing the binary and running gitea migrate, with no package manager involvement. For team deployments, configure Gitea to use an OAuth2 provider (LDAP, GitHub, Google) for single sign-on via Admin Panel → Authentication Sources, eliminating the need to manage separate Gitea user accounts.

Next steps: How to Install GitLab CE on RHEL 9, How to Install Jenkins on RHEL 9, and How to Install Ansible on RHEL 9.