DEV Community

Cover image for How I Host an openSUSE RPM Repository Using Gitea
David - TechOpt.io
David - TechOpt.io

Posted on Edited on Originally published at techopt.io AI-assisted

How I Host an openSUSE RPM Repository Using Gitea

I use both openSUSE Leap and Tumbleweed, and I wanted one place to manage RPM packages that aren't available through my usual repositories. Downloading the same RPM manually on every machine gets old, especially when the application updates frequently.

Since I already host Gitea, I decided to use its built-in RPM package registry rather than run another repository server.

The result is a single RPM repository that works with zypper on both Leap and Tumbleweed. I currently use it for Cursor, with an hourly job that checks for new upstream builds, signs and publishes them through Gitea, and removes old versions.

TL;DR: Gitea can serve an rpm-md repository directly. Upload RPMs to a package group, sign them through Gitea, import the signing key on openSUSE, and add the repository to zypper. My updater checks Cursor's latest RPM once per hour and keeps the two most recent builds.

Why Gitea Works as an RPM Repository

Gitea 1.20+ supports RPM package hosting, including the repository metadata that zypper, dnf, and yum understand. Gitea 1.23+ also supports signing RPMs during upload.

That means I don't need a separate web server full of RPMs or a job that runs createrepo_c. When I publish a package, Gitea updates the repository's repodata for me.

Here's the example configuration I'll use throughout this article:

Setting Value
Gitea server https://git.example.com
Package owner packages
RPM group opensuse
Architecture x86_64
Example package cursor
Repository URL https://git.example.com/api/packages/packages/rpm/opensuse

The word packages appears twice in that URL: once in the API route and once as the package owner's name. All domains, account names, and credentials in this guide are placeholders.

This is a mirror of upstream RPMs, not a package build system. I don't rebuild Cursor from source or maintain an openSUSE Build Service project. The upstream RPM simply needs to be compatible with my machines.

For example, the Cursor RPM I tested in September 2026 had an .el8 suffix, but installed successfully on Leap 15.6 and Tumbleweed. That's not a guarantee for every Fedora-targeted RPM: check its dependencies before mirroring another package.

1. Prepare Gitea for Large RPM Uploads

First, make sure the Gitea package registry is enabled and you're running a version that supports the signing features you want.

Cursor's RPM was around 290 MB when I set this up, so I also had to account for the upload limit on my reverse proxy. For nginx, for example:

client_max_body_size 512m;
Enter fullscreen mode Exit fullscreen mode

An HTTP 413 Request Entity Too Large response usually means the proxy isn't accepting the entire file.

Create a Gitea personal access token for the publisher with these scopes:

  • read:package
  • write:package

Keep that token on the publishing machine. Clients don't need publishing permissions, and if your package owner is private, they should use a separate read-only token.

2. Upload an RPM and Have Gitea Sign It

Gitea accepts RPM uploads using HTTP PUT. With an RPM downloaded to the current directory, I can publish it using:

curl --user USER:TOKEN --upload-file cursor.rpm \
  "https://git.example.com/api/packages/packages/rpm/opensuse/upload?sign=true"
Enter fullscreen mode Exit fullscreen mode

The important detail is sign=true. The upstream Cursor RPM I used was unsigned, and the repository configuration expects signed packages with gpgcheck=1.

You can also enable signing by default in Gitea's app.ini:

[packages]
DEFAULT_RPM_SIGN_ENABLED = true
Enter fullscreen mode Exit fullscreen mode

A successful upload returns 201 Created and regenerates the repository metadata. A 409 Conflict means that exact package version is already present; my publisher leaves it alone rather than deleting and uploading it again.

3. Import Gitea's Signing Key on openSUSE

Before installing anything, I import the public key associated with the Gitea package owner.

For this example, the key is published at:

https://git.example.com/api/packages/packages/rpm/repository.key
Enter fullscreen mode Exit fullscreen mode

Gitea serves this key in a format that I first convert to ASCII armor using GnuPG. In a root shell (sudo -i), run:

curl -fsS -o repository.key \
  "https://git.example.com/api/packages/packages/rpm/repository.key"

gpg --batch --import repository.key
mkdir -p /etc/pki/rpm-gpg
gpg --batch --export --armor > /etc/pki/rpm-gpg/gitea-packages-opensuse.asc
rpm --import /etc/pki/rpm-gpg/gitea-packages-opensuse.asc
Enter fullscreen mode Exit fullscreen mode

On a machine with other GnuPG public keys already imported, export only the intended Gitea key rather than exporting every key from your keyring. Verify the key's fingerprint through a trusted channel before importing it.

Each Gitea package owner has its own signing key. If you change owners, you'll need the corresponding key on the clients.

4. Connect zypper to the Repository

I configure Leap and Tumbleweed the same way. One small adjustment has also saved me trouble with large RPM downloads: I set TMPDIR to /var/tmp before using zypper.

export TMPDIR=/var/tmp
mkdir -p "$TMPDIR"
Enter fullscreen mode Exit fullscreen mode

On systems where /tmp is a separate tmpfs, using /var/tmp avoids a cross-filesystem rename problem when moving a downloaded RPM into place. Keep the same shell open for the installation commands below.

My setup: a private Gitea package owner

My package owner is private, so anonymous repository refreshes won't work. I store a read-only Gitea token in zypper's credentials directory instead of putting it in the repository URL.

Run the following as root:

install -d -m 700 /etc/zypp/credentials.d
umask 077

cat > /etc/zypp/credentials.d/gitea-packages-opensuse <<'EOF_CREDS'
username=USER
password=READ_TOKEN
EOF_CREDS

chmod 600 /etc/zypp/credentials.d/gitea-packages-opensuse
Enter fullscreen mode Exit fullscreen mode

Then create /etc/zypp/repos.d/gitea-packages-opensuse.repo:

[gitea-packages-opensuse]
name=packages openSUSE
baseurl=https://git.example.com/api/packages/packages/rpm/opensuse?credentials=gitea-packages-opensuse
enabled=1
autorefresh=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/gitea-packages-opensuse.asc
type=rpm-md
Enter fullscreen mode Exit fullscreen mode

The ?credentials=gitea-packages-opensuse part tells libzypp to read the credentials from the file with that name. It doesn't expose the token in the .repo file.

Now refresh and install:

zypper --non-interactive --gpg-auto-import-keys refresh gitea-packages-opensuse
zypper --non-interactive install --allow-vendor-change cursor
Enter fullscreen mode Exit fullscreen mode

The vendor-change flag is useful if a machine already has Cursor installed from a different source. Future updates are straightforward:

zypper refresh
zypper update cursor
Enter fullscreen mode Exit fullscreen mode

If the package owner is public

Public repositories are easier because clients don't need a credentials file. After importing the owner's signing key, add Gitea's generated repository:

zypper addrepo https://git.example.com/api/packages/packages/rpm/opensuse.repo
zypper refresh
zypper install cursor
Enter fullscreen mode Exit fullscreen mode

Keep TMPDIR=/var/tmp set for the install. If the generated .repo references the raw signing key, edit its gpgkey to point to the local armored .asc file shown above.

That's it: both openSUSE distributions can install packages from the same group with normal zypper commands.

5. Keep Cursor Updated Automatically

Uploading an RPM by hand is fine initially, but I don't want to check for new Cursor releases every day. My publishing job runs once an hour and watches this URL:

https://api2.cursor.sh/updates/download/golden/linux-x64-rpm/cursor/latest
Enter fullscreen mode Exit fullscreen mode

It redirects to the current RPM download. I inspect the redirect with:

curl -fsSI \
  "https://api2.cursor.sh/updates/download/golden/linux-x64-rpm/cursor/latest"
Enter fullscreen mode Exit fullscreen mode

The destination contains a production/<commit>/ segment. My publisher stores that commit in a state file and compares it on the next run. If the commit hasn't changed, it skips downloading another large RPM.

Use the URL ending in /cursor/latest. A URL ending in a particular release line (for example, /cursor/3.22) could stop following newer minor versions. The version and commit values from September 2026 were just snapshots, not current release numbers.

When the commit changes, my job:

  1. Downloads the upstream RPM.
  2. Reads its name, version, release, and architecture using rpm -qp --nosignature.
  3. Uploads it to the opensuse group with sign=true.
  4. Saves the new commit identifier after successful publication.
  5. Lists package versions in Gitea and deletes all but the newest two.

For example, you can inspect package metadata with:

rpm -qp --nosignature \
  --queryformat '%{NAME}\n%{VERSION}-%{RELEASE}\n%{ARCH}\n' \
  cursor.rpm
Enter fullscreen mode Exit fullscreen mode

Gitea exposes package versions at an endpoint like:

GET /api/v1/packages/packages/rpm/cursor?limit=50
Enter fullscreen mode Exit fullscreen mode

My publisher sorts versions by created_at and keeps the newest two. To delete an older version, it calls the registry's delete endpoint:

curl --user USER:TOKEN -X DELETE \
  "https://git.example.com/api/packages/packages/rpm/opensuse/package/cursor/VERSION-RELEASE/x86_64"
Enter fullscreen mode Exit fullscreen mode

The two-version limit gives me one previous build without accumulating gigabytes of old RPMs. The publishing script itself is a private local project, but these are the steps it performs.

6. Schedule the Publisher With systemd

I run the publisher from an always-on Linux machine using a systemd user timer. This avoids setting up Gitea Actions or another CI runner just to mirror one package.

My private environment file, ~/.config/opensuse-rpm/env, contains placeholders like:

GITEA_URL=https://git.example.com
GITEA_OWNER=packages
GITEA_USER=USER
GITEA_TOKEN=TOKEN
GITEA_GROUP=opensuse
KEEP=2
Enter fullscreen mode Exit fullscreen mode

Make sure the real file is readable only by its owner (chmod 600).

The service at ~/.config/systemd/user/opensuse-rpm-sync.service is:

[Unit]
Description=Publish vendor RPMs to the Gitea openSUSE repository
Wants=network-online.target
After=network-online.target

[Service]
Type=oneshot
EnvironmentFile=%h/.config/opensuse-rpm/env
ExecStart=%h/bin/sync-opensuse-rpm.sh
Nice=10
Enter fullscreen mode Exit fullscreen mode

ExecStart is an example path; point it to your own script implementing the workflow above.

The timer at ~/.config/systemd/user/opensuse-rpm-sync.timer is:

[Unit]
Description=Hourly openSUSE RPM sync

[Timer]
OnCalendar=hourly
Persistent=true
RandomizedDelaySec=5min

[Install]
WantedBy=timers.target
Enter fullscreen mode Exit fullscreen mode

To enable it:

systemctl --user daemon-reload
systemctl --user enable --now opensuse-rpm-sync.timer
loginctl enable-linger "$USER"
Enter fullscreen mode Exit fullscreen mode

Lingering lets the user timer continue running when I'm not logged in. Persistent=true also catches up on missed scheduled runs when the machine comes back online.

Adding More RPMs Later

The nice part is that I can add other vendor RPMs without adding another repository to every openSUSE installation.

Each package gets its own source definition and state file, but uploads go to the same opensuse group. For example, another package could use a direct URL:

NAME=example
KIND=url
URL=https://example.com/example-latest.x86_64.rpm
KEEP=2
Enter fullscreen mode Exit fullscreen mode

My publisher supports redirect-based sources, direct URLs (checking HTTP metadata or SHA256), and local RPM files (checking SHA256). Keeping state separately for each package ensures one update doesn't interfere with another.

Once an additional RPM is published, clients just run zypper refresh and install the package by name. Adding the repository does not automatically install every RPM in it.

A Few Things to Watch Out For

  • HTTP 413 on upload: Increase the request body limit on the reverse proxy in front of Gitea.
  • Signature verification errors: Confirm the RPM was signed, then check that the client imported the correct owner's key. Don't disable gpgcheck to hide the problem.
  • Private repository won't refresh: Check the read token, the /etc/zypp/credentials.d file permissions, and the ?credentials= filename.
  • A download fails during a rename: Try using TMPDIR=/var/tmp in the same shell as zypper.
  • Updates aren't detected: Check the /cursor/latest redirect and the systemd service logs.

One final Cursor-specific detail: on systems with dnf installed, the Cursor RPM may create /etc/yum.repos.d/cursor.repo. I remove that extra repository file so it doesn't become a second source for Cursor:

rm -f /etc/yum.repos.d/cursor.repo
Enter fullscreen mode Exit fullscreen mode

Would I Use Gitea for RPM Hosting Again?

Yes. For my setup, Gitea already handles package storage, signing, and repository metadata, while zypper handles the client-side installation and updates. I don't need to maintain another repository service just to make a few third-party RPMs available on Leap and Tumbleweed.

There is still a small custom publishing job to maintain, and I need to verify that upstream RPMs remain compatible with openSUSE. But once the registry and clients are configured, it's a convenient way to manage the packages across my machines.

If you're also maintaining Leap systems, I wrote a separate guide on upgrading openSUSE Leap 15.6 to 16.0.

Originally published on TechOpt.io: Host an openSUSE RPM Repository With Gitea and zypper.

Top comments (0)