Skip to main content
Version: 21.5 - latest

Install on Linux

Follow these steps to run Gitea Enterprise as a native service on a Linux host.

Prerequisites

  • A 64-bit Linux distribution with systemd (for example Ubuntu 22.04, Debian 12, RHEL 9, Rocky Linux 9).
  • Root access or the ability to run sudo.
  • External MySQL/MariaDB or PostgreSQL database. Gitea Enterprise does not support SQLite.
  • Git command-line tools (installed in the steps below).
  • (Optional) An Enterprise license to unlock Enterprise features. See License Activation when you are ready to apply one.

1. Prepare the host

  1. Install dependencies (consult the upstream dependency list if you plan to use MySQL/PostgreSQL, image processing, or other optional features):

    • Debian/Ubuntu

      sudo apt update
      sudo apt install -y git ca-certificates
    • RHEL/CentOS/Rocky

      sudo dnf install -y git ca-certificates
      # Replace dnf with yum if you run an older release
  2. Create the git system user and directories:

    • Debian/Ubuntu

      sudo adduser \
      --system \
      --shell /bin/bash \
      --gecos "Git Version Control" \
      --group \
      --disabled-password \
      git

      sudo mkdir -p /var/lib/gitea/{custom,data,log}
      sudo chown -R git:git /var/lib/gitea
      sudo chmod -R 750 /var/lib/gitea
      sudo mkdir -p /etc/gitea
      sudo chown root:git /etc/gitea
      sudo chmod 770 /etc/gitea
    • RHEL/CentOS/Rocky

      sudo groupadd --system git
      sudo useradd \
      --system \
      --shell /bin/bash \
      --comment "Git Version Control" \
      --gid git \
      git

      sudo mkdir -p /var/lib/gitea/{custom,data,log}
      sudo chown -R git:git /var/lib/gitea
      sudo chmod -R 750 /var/lib/gitea
      sudo mkdir -p /etc/gitea
      sudo chown root:git /etc/gitea
      sudo chmod 770 /etc/gitea

      If the git group already exists, you can ignore the warning from groupadd.

    The git user keeps its default home directory; /var/lib/gitea simply hosts the application data. This layout matches the recommended Gitea Enterprise directory structure so existing automation remains compatible.

2. Configure the database (optional)

External databases improve scalability and availability. Gitea Enterprise supports MySQL/MariaDB and PostgreSQL out of the box. Run these commands before the first start so the application can connect immediately.

MySQL / MariaDB

  1. Install the client packages:

    sudo apt install -y mysql-client        # Debian/Ubuntu
    sudo dnf install -y mysql # RHEL/CentOS/Rocky
  2. Create the database and user (adjust credentials to your policy):

    mysql -u root -p <<'SQL'
    CREATE DATABASE gitea CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
    CREATE USER 'gitea'@'%' IDENTIFIED BY 'change-me-now';
    GRANT ALL PRIVILEGES ON gitea.* TO 'gitea'@'%';
    FLUSH PRIVILEGES;
    SQL
  3. Point Gitea to MySQL in /etc/gitea/app.ini:

    [database]
    DB_TYPE = mysql
    HOST = db.internal:3306
    NAME = gitea
    USER = gitea
    PASSWD = change-me-now
    SSL_MODE = disable

PostgreSQL

  1. Install the client packages:

    sudo apt install -y postgresql-client   # Debian/Ubuntu
    sudo dnf install -y postgresql # RHEL/CentOS/Rocky
  2. Create the database and user:

    sudo -u postgres psql <<'SQL'
    CREATE DATABASE gitea WITH ENCODING 'UTF8' LOCALE 'C' TEMPLATE template0;
    CREATE USER gitea WITH PASSWORD 'change-me-now';
    GRANT ALL PRIVILEGES ON DATABASE gitea TO gitea;
    SQL
  3. Configure /etc/gitea/app.ini for PostgreSQL:

    [database]
    DB_TYPE = postgres
    HOST = db.internal:5432
    NAME = gitea
    USER = gitea
    PASSWD = change-me-now
    SSL_MODE = disable

Restart Gitea after updating the connection details.

3. Install the Gitea Enterprise binary

  1. Pick the Enterprise release you plan to run (for example 24.6.0).

  2. Download and install the binary:

    VERSION=24.6.0
    curl -L -o gitea \
    "https://gitea.com/commitgo/gitea-ee/releases/download/v${VERSION}/gitea-ee-${VERSION}-linux-amd64"
    sudo mv gitea /usr/local/bin/gitea
    sudo chown root:root /usr/local/bin/gitea
    sudo chmod 755 /usr/local/bin/gitea

    Replace VERSION with the Enterprise release you selected. Use the *-linux-arm64 artifact on ARM servers.

  3. (Optional) Copy an existing app.ini into /etc/gitea/app.ini if you want to skip the setup wizard.

4. Configure systemd

Create /etc/systemd/system/gitea.service based on the reference unit:

[Unit]
Description=Gitea (Enterprise)
After=network.target

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

[Install]
WantedBy=multi-user.target

Reload the service manager and start Gitea:

sudo systemctl daemon-reload
sudo systemctl enable --now gitea

Browse to http(s)://<host>:3000/ to finish the initial setup wizard, then follow License Activation to enable Enterprise features.

5. Post-install configuration

After Gitea Enterprise is running, review the configuration options you may want to enable (SMTP, object storage, authentication, and so on). The upstream Configuration Cheat Sheet lists every app.ini setting with short explanations. Update /etc/gitea/app.ini, then restart the service when you apply changes.

6. Upgrades and maintenance

  • Stop the service, download the newer Enterprise binary, replace /usr/local/bin/gitea, and start the service.
  • Follow the upstream maintenance guidance for backups, staging tests, and database migrations.
  • For multi-node deployments, provision externalized Redis, object storage, and load balancing to match your redundancy targets before adding more application nodes.

Gitea Enterprise keeps configuration and data layouts stable across releases, so existing automation continues to work.