Build a YUM Repository
You build or collect RPMs for EL hosts and want dnf install to work against your own
repository, today and after every later update. This tutorial builds a YUM
standard repository, which SOW maintains in a
workspace: one package set, el9, with x86_64 and aarch64 indexes that share a single
package pool, a policy that keeps only the newest version and drops debug packages, and a
dnf client that installs from it.
You need:
- SOW 0.9.0 (Installation) and Python 3 for the preview server.
- RPM files built for your clients, here
/path/to/packages/. - An empty
/srv/sowdirectory your user can create and write to, or another path. - For step 5, an EL host with
dnf. The preview listens on127.0.0.1only, so run the client on the same host or publish the repository first.
Create the workspace
sow init makes /srv/sow a workspace: sow.yml plus private state. pigsty is the
standard repository inside it, the directory tree you will serve. el9 is a Dist: one RPM
package set with its own index for each architecture.
Set membership policy
Policy decides which of the packages you add each Dist actually publishes. Edit the
generated sow.yml; this example keeps one version per package name and architecture and
excludes debug and LLVM JIT packages:
Check the configuration:
exclude runs before limit. noarch packages enter every enabled architecture view, and
architectures takes CPU architecture names only. See Membership policy
for the other filters.
Add RPMs
add stores each accepted package once in the pool, updates membership, and builds the
indexes. It reports one line per package: a file that the policy filters out is reported
as excluded without failing the whole command.
The public tree has this shape:
/srv/sow/pigsty/
- pool/
dists/el9/
- x86_64/repodata/
- aarch64/repodata/
Each repodata/ reaches the packages in pool/ through relative paths, so serve or copy
the complete pigsty/ tree, never a single dists/ directory.
Preview over HTTP
Run this in a separate terminal and leave it running:
The preview serves the repository root to the same host only. For a persistent service or clients on other hosts, use Serve and publish.
Configure dnf
On the host running the preview, save this as /etc/yum.repos.d/pigsty.repo. For a
remote client, publish the repository first and use its public base URL:
dnf expands $basearch to x86_64 or aarch64, so the same file works on both
architectures. Signature checks are off because nothing is signed yet.
Refresh and query the repository:
The repository works when makecache succeeds and list available shows the packages you
added. After the preview, remove the source file and stop the Python server.
Publish or export
To give other hosts access, use sow publish with a filesystem
or R2 target. It uploads packages and metadata in the order clients need. The same
tutorial covers manual delivery to isolated hosts.
Some mirroring tools, including default dnf reposync, reject rpm-md package locations
that climb to the shared pool. For those consumers, export a self-contained RPM leaf for one
Dist and architecture:
The destination must be absent or empty, and its parent directory must already exist.
Export reads the latest build, so run sow build first if membership changes are pending;
otherwise it exits 5. sow export lists the full requirements. Export copies package files by default.
--hardlink works only on the same filesystem, and the exported files then share storage
with the pool, so keep them read-only.
Update the repository
add builds the update itself. With limit: 1, the newest version replaces the previous
member for each package name and architecture. After you change sow.yml, run
sow build -r pigsty to apply the new policy.
To withdraw a package, preview the selection with
sow rm PACKAGE_NAME -r pigsty -d el9 --check, then repeat without --check. A package
name selects all its versions and architectures; use a SHA-256 reference to select one
package object.
Next
- Sign your repository so
dnfcan verify metadata and packages. - Serve and publish the repository to other hosts.
- Platforms & Integrations lists the tested clients.