Skip to content

This is the multi-page printable view of this section.

Return to the regular view of this page

Get Started

Install SOW, turn a directory into a simple repository in five minutes, then build a standard repository.

This section takes you from nothing to a repository that dnf and apt can install from. SOW is a single executable with no service to run, so installation takes a minute. After that, pick the path that matches what you have:

  • You have a directory of packages and want it installable. Follow the Quick start to make it a simple repository: one command, no configuration, about five minutes.

  • You maintain a repository that changes over time, serves several distributions, or needs signing and publication. Follow Your first standard repository, then read Core concepts.

  • Installation — Install from the Pigsty repository, a release package, an archive, or source.

  • Quick start — Index a directory of RPM and DEB files and install from it.

  • Your first standard repository — Serve EL9 and Debian clients from one repository.

  • Core concepts — Simple or standard repository, and the model behind Dists, the pool, and Generations.

1 - Installation

Install SOW from the Pigsty repository, a release package, an archive, or source, and upgrade an existing workspace.

SOW is a single executable. It needs no daemon, no database server, and no language runtime, and it parses packages and writes metadata itself, so there is no createrepo_c or dpkg to install either. Choose a channel:

Channel Platforms Choose it when
Pigsty repository Linux, amd64 / arm64 You want apt or dnf to install and update SOW
RPM or DEB package Linux, amd64 / arm64 You need a specific version, or an offline host
Archive Linux and macOS, amd64 / arm64 You are on macOS, or don’t want a system package
Source Linux or macOS (amd64 or arm64) You build your own binaries

Release packages, archives, and SHA256SUMS for SOW 0.9.0 are on the Download page.

From the Pigsty repository

SOW ships in the Pigsty infra repository. This channel is rolling: it installs the SOW version available in the configured repository. Use a tagged release asset when you need an exact version.

# Debian / Ubuntu
sudo tee /etc/apt/sources.list.d/pigsty-infra.list > /dev/null <<'EOF'
deb [trusted=yes] https://repo.pigsty.io/apt/infra generic main
EOF
sudo apt update && sudo apt install -y sow
# RHEL / Rocky / Alma and compatible
sudo tee /etc/yum.repos.d/pigsty-infra.repo > /dev/null <<'EOF'
[pigsty-infra]
name=Pigsty Infra for $basearch
baseurl=https://repo.pigsty.io/yum/infra/$basearch
enabled=1
gpgcheck=0
module_hotfixes=1
EOF
sudo dnf makecache && sudo dnf install -y sow

These examples skip signature checks for the Pigsty source (trusted=yes, gpgcheck=0). In mainland China, replace repo.pigsty.io with the repo.pigsty.cc mirror.

Install a Linux package

Download the package for your architecture and SHA256SUMS, check the package against its line in SHA256SUMS, then install it:

# RPM, x86_64
sudo rpm -Uvh ./sow-0.9.0-1PGSTY.x86_64.rpm

# Debian or Ubuntu, amd64
sudo apt install ./sow_0.9.0-1PGSTY_amd64.deb

For ARM64, use the RPM ending in .aarch64.rpm or the DEB ending in _arm64.deb. The packages install the executable at /usr/bin/sow.

Install an archive

Download the archive and SHA256SUMS into an empty directory. For Linux amd64:

set -euo pipefail
grep -F '  sow_0.9.0_linux_amd64.tar.gz' SHA256SUMS | sha256sum -c -
tar -xzf sow_0.9.0_linux_amd64.tar.gz
sudo install -m 0755 sow /usr/local/bin/sow

On macOS, use darwin_amd64 or darwin_arm64 in the archive name and shasum -a 256 -c - for the checksum. Without root access, install into your home directory instead:

mkdir -p "$HOME/.local/bin"
install -m 0755 sow "$HOME/.local/bin/sow"
export PATH="$HOME/.local/bin:$PATH"   # also add this line to your shell profile

Build from source

You need Go 1.27.4 or newer and Git. SOW builds with CGO_ENABLED=0, so no C compiler is involved.

set -euo pipefail
git clone --branch v0.9.0 https://github.com/pgsty/sow.git
cd sow
SOW_BUILD_DIR="$(mktemp -d)"
CGO_ENABLED=0 go build -trimpath \
  -ldflags='-s -w -X github.com/pgsty/sow/internal/v2cli.Version=0.9.0' \
  -o "$SOW_BUILD_DIR/sow" ./cmd/sow
sudo install -m 0755 "$SOW_BUILD_DIR/sow" /usr/local/bin/sow

Verify the installation

sow version
sow help

sow version prints the version, platform, and Go toolchain, for example sow 0.9.0 linux/amd64 go1.27.4. sow help lists the commands, and sow help COMMAND shows one command’s options as implemented by the binary you have.

Storage and optional tools

The user running SOW needs read access to the input packages and write access to the repository. Put a workspace on a local POSIX filesystem (APFS on macOS); SOW relies on file locks, fsync, and atomic rename, which network filesystems do not reliably provide.

Signing is optional. Depending on how you sign, you may need host tools:

Signing method Required tools
Metadata signing with an OpenPGP key file or key material None
Metadata signing with a GPG key ID or fingerprint gpg and gpg-agent
RPM package signing rpm with a working GPG signing setup

Next: the Quick start for a simple repository, or Your first standard repository.

Upgrade to 0.9.0

Workspaces created by SOW 0.5.0 through 0.8.0 already use database schema v13, so there is no migration: install the new binary, rebuild, and check. Your sow/v3 configuration and public URLs stay as they are.

Warning

Check targets with max_cache_ttl: 0s first. Before 0.9.0, target GC kept superseded files for at least 30 days whatever the TTL. 0.9.0 uses max_cache_ttl as the grace period directly. With 0s, a filesystem target may delete eligible files at its next sow gc TARGET. R2 reports candidates unless you pass --delete. Recorded deadlines still protect older publications.

  1. Stop everything that writes to the workspace.
  2. Back up the complete workspace with a tool that preserves hard links, such as rsync -aH or tar.
  3. For each target with max_cache_ttl: 0s, decide whether clients need a longer window; set the required lifetime in sow.yml before the next publication.
  4. Install SOW 0.9.0.
  5. Build and check each repository listed in sow.yml:
sow version
sow build -r REPOSITORY -C /srv/sow
sow check -r REPOSITORY -C /srv/sow

REPOSITORY is the repository name from sow.yml. A repository with no pending changes produces a no-op build that keeps its Generation number and metadata timestamps, so clients see nothing new.

If you changed the TTL of an already published target, use sow publish TARGET --rebind when you are ready to deliver the checked build. A target that has never been published gets its settings on its first sow publish TARGET.

Local GC plans that were interrupted under 0.7.1 with an empty manifest array resume directly under 0.9.0. Before a downgrade, check the configuration against the target version. Versions through 0.8.0 require the name sow.yml. Versions through 0.6.1 also reject the passfile field.

Workspaces from 0.2, 0.3, or 0.4

Repositories created by 0.2.0, 0.3.0, and 0.4.0 use SQLite schemas v8, v10, and v12 respectively. SOW 0.9.0 can migrate each directly to v13. Stop writers and back up the complete workspace with hard links preserved. After installing 0.9.0, run these commands for each repository.

sow repo migrate REPOSITORY -C /srv/sow
sow build -r REPOSITORY -C /srv/sow
sow check -r REPOSITORY -C /srv/sow

repo migrate reports the old and new schema versions. build refreshes views that need rebuilding and may report noop=true if they are current. Finish by checking the whole repository. To go back to a version that uses the older schema, restore the backup. See sow repo migrate and the 0.9.0 release notes.

Upgrade instructions for earlier releases

Target version Upgrade notes
0.8.0 Finish interrupted 0.7.1 local GC before upgrading.
0.7.1 Existing schema v13 workspaces need no migration.
0.7.0 Check passfile compatibility before downgrading.
0.6.1 No migration from 0.5.0 or 0.6.0.
0.6.0 Check the publication time of simple YUM repositories.
0.5.0 Migrate standard repositories to schema v13.
0.4.0 Migrate a 0.3 workspace.
0.3.0 Migrate a 0.2.0 workspace from schema v8 to v10.

Upgrade a simple repository

A simple repository keeps no database, so upgrading is just installing the new binary. If you are switching an existing YUM repository from another generator to SOW, follow Migrate an existing YUM repository: --metadata-timestamp still defaults to 0, and clients with cached metadata need a timestamp derived from the repository’s publication history.

2 - Quick Start

Turn a directory of RPM and DEB files into a repository, serve it, and install a package from it in about five minutes.

In about five minutes you will turn a directory of package files into a repository, serve it over HTTP, and install a package from it with dnf or apt. The result is a simple repository: no workspace, no configuration file, no database. The directory is the repository.

You need:

  • SOW, from Installation;
  • at least one RPM or DEB file;
  • Python 3, for a throwaway web server;
  • a Linux host with dnf or apt for the final install step (on macOS you can still build and check the repository).

Prepare a directory

Copy your packages into a new directory. Use whichever formats you have; one RPM or one DEB is enough.

mkdir -p "$HOME/sow-quickstart"
cp /path/to/example.rpm "$HOME/sow-quickstart/"
cp /path/to/example.deb "$HOME/sow-quickstart/"

Keep the files at the top level: sow create does not look into subdirectories.

Generate metadata

sow create "$HOME/sow-quickstart"

SOW reads every package, then writes the indexes for the formats it found. With one RPM and one DEB:

created /home/you/sow-quickstart: rpm=1 deb=1 signed=0 removed=0 marker=false noop=false recovered=false

The indexes now sit next to your packages, which SOW leaves untouched:

  • sow-quickstart/
    • example.rpm
    • example.deb
    • repodata/YUM/DNF metadata, read through repomd.xml
    • Packagesflat APT index
    • Packages.gz

This is a complete repository. For DEBs it is a flat APT repository: Packages only, without the Release file that signed APT repositories need. Use a standard repository when you want signed APT metadata.

Start a local server

Run this in a separate terminal and leave it running:

python3 -m http.server --bind 127.0.0.1 --directory "$HOME/sow-quickstart" 8080

Check that the entry point for each format you added is reachable:

# RPM
curl --fail http://127.0.0.1:8080/repodata/repomd.xml >/dev/null

# DEB
curl --fail http://127.0.0.1:8080/Packages.gz >/dev/null

This server only listens on the local host. Serve and publish covers a real web server for other machines.

Configure a local client

On the Linux host running the server, add the repository to your package manager. The repository is unsigned, so these examples turn signature checks off; Sign your repository shows how to turn them on.

Replace PACKAGE_NAME with an uninstalled package from your test repository that matches the client architecture. The commands enable only that repository, so its dependencies must already be installed or available there.

Save this as /etc/yum.repos.d/sow-quickstart.repo:

[sow-quickstart]
name=SOW Quick Start
baseurl=http://127.0.0.1:8080/
enabled=1
gpgcheck=0
repo_gpgcheck=0

Load the index and install one of your packages:

sudo dnf --disablerepo='*' --enablerepo=sow-quickstart makecache
sudo dnf --disablerepo='*' --enablerepo=sow-quickstart install PACKAGE_NAME

Save this as /etc/apt/sources.list.d/sow-quickstart.list:

deb [trusted=yes] http://127.0.0.1:8080/ ./

The trailing ./ tells APT this is a flat repository. Load the index and install one of your packages:

sudo apt-get -o Dir::Etc::sourcelist=/etc/apt/sources.list.d/sow-quickstart.list \
  -o Dir::Etc::sourceparts=- update
sudo apt-get -o Dir::Etc::sourcelist=/etc/apt/sources.list.d/sow-quickstart.list \
  -o Dir::Etc::sourceparts=- install PACKAGE_NAME

A successful download and install verifies that the client can use the repository.

Update the repository

To change the repository, change the files and run sow create again:

sow create "$HOME/sow-quickstart"

The output depends only on the package files and options. If nothing changed, SOW reports noop=true and leaves the metadata as it was, so the command is safe to run from cron or CI.

A directory you keep adding RPMs to will collect old versions. sow prune keeps the newest version of each RPM name and architecture, rewrites repodata/, and only then deletes the superseded files. Preview first:

sow prune "$HOME/sow-quickstart" --dry-run
sow prune "$HOME/sow-quickstart"

DEB files and indexes are left alone.

When you’re done, stop the server with Ctrl+C and delete the source file you added to the client.

Note

Replacing a repository that createrepo_c built and clients already use? Read Migrate an existing YUM repository first: clients with cached metadata need a metadata timestamp that never goes backwards.

Next

A simple repository is enough as long as the directory is the whole story. When you need several distributions from one set of files, version limits, signed metadata, build history, or publication to a remote target, continue with Your first standard repository. All options for simple repositories are in sow create and sow prune.

3 - Your First Standard Repository

Build a standard repository that serves EL9 and Debian clients from one tree, then check it.

This walkthrough builds one standard repository that serves two kinds of clients: EL9 hosts through a YUM index and Debian hosts through an APT index. Along the way you will meet what a standard repository adds over a simple one: named package sets (Dists), a shared package pool, and a recorded build that you can verify before anyone downloads from it.

You need SOW, some RPM or DEB files (one of each format is enough), and an empty writable directory. The examples use /srv/sow; substitute a path under your home directory if you don’t have write access to /srv.

Initialize the workspace

sow init /srv/sow
cd /srv/sow

init creates the configuration file and the private state directory:

  • /srv/sow/
    • sow.ymlconfiguration you edit (schema: sow/v3)
    • .sow/databases, locks, and recovery records, managed by SOW

Running init again initializes newly declared repositories and Dists and can recreate a missing per-repository lock. If a populated workspace has lost .sow/workspace.lock, follow offline lock recovery.

Create a repository and two Dists

sow repo new local
sow dist new el9 --format rpm
sow dist new bookworm --format deb

local is the repository, the directory you will serve. el9 and bookworm are Dists: named package sets of one format each. The names are labels you choose; for APT clients, bookworm will also be the suite name. These commands record both Dists in sow.yml for you.

Each Dist starts with valid, empty indexes for x86_64 and aarch64, so a client can already point at it:

  • /srv/sow/local/
    • pool/package files, shared by every Dist
    • dists/
      • el9/
        • x86_64/repodata/
        • aarch64/repodata/
      • bookworm/
        • Release
        • main/
          • binary-amd64/Packages, Packages.gz, by-hash/
          • binary-arm64/

Add packages

Tell add which Dist each batch belongs to:

sow add /path/to/packages/*.rpm -d el9
sow add /path/to/packages/*.deb -d bookworm

For each file, SOW reads the name, version, and architecture from the package header, copies the file into local/pool/ once, adds it to the Dist, and rebuilds that Dist’s indexes. The summary line tells you how it went, followed by one item line per input:

add repository=local operation=3572843618681363018 accepted=2 failed=0 memberships=+2/-0 revision=1 generation=3 dirty=false

From now on SOW works from its pool; you can delete or move the original files.

Inspect and verify

sow status
sow ls -d el9
sow check

status should report status=clean ready_to_copy=true: membership and the built files agree, and the tree is ready to serve. ls lists each Dist’s packages with their pool paths. check re-reads every package and index, compares them with the recorded build, and exits 0 only if everything matches. Run it before you ship a build.

Serve the repository

Serve the repository directory /srv/sow/local, never the workspace root: sow.yml and .sow/ must not be reachable over HTTP. Clients need both dists/ and pool/, because the indexes point into the pool.

Serve and publish sets this up with Nginx. The YUM and APT tutorials show the client configuration.

Batch later updates

Each add rebuilds the affected Dists. When you import several batches, skip the build on each one and build once at the end:

sow add /path/to/more/*.rpm -d el9 --skip
sow add /path/to/more/*.deb -d bookworm --skip
sow build

Between the --skip imports and the build, sow status reports dirty and ready_to_copy=false, while the served tree still holds the previous build.

Selection rules

The commands above did not name a workspace or repository because SOW found them: it looks for sow.yml or sow.yaml in the current directory and its parents, and a workspace with a single repository selects it automatically. From another directory, add -C /srv/sow. Once a workspace holds several repositories, add -r local. -d NAME selects a Dist and can be repeated. The full rules are in Commands.

Next

4 - Core Concepts

Choose between a simple and a standard repository, and learn the model behind workspaces, Dists, the package pool, and Generations.

SOW builds two kinds of repository and uses a handful of concepts. The first section is enough to choose between them; the rest explains how a standard repository is put together, and why.

Simple or standard repository

The two kinds differ in where the truth about the repository lives.

A simple repository is a directory of package files, and the directory is the state. sow create indexes whatever packages are in it. To change the repository, change the files and run the command again. SOW keeps nothing else, so there is nothing to back up, migrate, or recover except the directory itself.

A standard repository is one that SOW maintains inside a workspace. SOW records what each package set should contain, separately from the files it serves. That record is what lets it enforce version limits, sign indexes, compare builds, recover from interruptions, and publish only what changed.

Need Simple repository Standard repository
Build indexes from packages sow create DIR sow add, which builds automatically
Where the state lives The directory contents sow.yml and private SQLite databases
Organize packages One flat directory; RPM and DEB can coexist Named Dists, one format each
Per-architecture indexes No Yes
Filters and version limits sow prune DIR keeps the newest RPM per name and architecture; --pigsty cleanup exclude and limit per Dist
Sign RPM packages Yes Yes
Sign repository metadata Outside SOW Configured in sow.yml
Build history and publication Outside SOW Built in

Choose a simple repository when something else, such as a CI job or a build script, already decides which files belong in the directory. Choose a standard repository when you want SOW to make and remember those decisions: several distributions, version limits, signed metadata, build history, or publication to a remote target. Switching later is cheap, because sow add takes the same package files.

The CLI uses its own internal names for the two: sow help calls what sow create builds a flat repository, errors from create and prune start with plain:, and most errors from workspace commands contain managed:.

Workspace, repository, and Dist

Standard repositories live in a workspace. Using the names from Your first standard repository:

  • /srv/sow/workspace
    • sow.ymlconfiguration you edit
    • .sow/databases, locks, recovery records (private)
    • local/standard repository: the tree clients read
      • pool/package files, one copy each
      • dists/
        • el9/an RPM Dist
          • x86_64/repodata/
          • aarch64/repodata/
        • bookworm/a DEB Dist
          • main/binary-amd64/ ...

A workspace is the directory that sow init creates: it holds sow.yml and the private .sow/ directory. One workspace usually serves one host or team and can hold several repositories. Commands that operate on standard repositories find it by looking for sow.yml or sow.yaml, which is why this docs site calls them workspace commands.

A repository is what clients see: pool/ plus dists/, served as one tree. It is also the boundary for storage, history, and publication. Each repository has its own pool, its own build history, and its own publication targets, so retention and cleanup in one never affect another. Use separate repositories for content with separate lifecycles, such as infrastructure tools and database extensions.

A Dist is a named set of packages in one format, such as el9 for RPMs or bookworm for DEBs. The name is your label: SOW checks each package’s format and architecture, not whether it suits the operating system the name suggests. APT clients use the Dist name as the suite.

An architecture view is the index that clients of one architecture read, for example dists/el9/x86_64/repodata/. Architecture-neutral packages, RPM noarch and DEB all, appear in every view of their Dist.

Serve the repository directory only. sow.yml and .sow/ must stay outside the web root.

Store each package once

When several Dists or architectures need the same package, a standard repository still stores one file. SOW identifies it by the SHA-256 of its contents and reads its name, version, and architecture from the package header. Every view that includes it gets index entries that point back to that one file under pool/. A noarch package shared by three EL Dists on two architectures is one file, not six, and a publication uploads it once.

Two consequences follow:

  • Serve or copy the complete repository root. RPM indexes reach the pool through relative paths such as ../../../pool/…, and APT Filename entries are relative to the repository root. A single view directory on its own cannot resolve them.
  • Some mirror tools need an export. Default dnf reposync rejects parent-relative paths. sow export rpm-leaf writes a standalone copy of one RPM view for it.

Separate repositories never share a pool. Pool and views covers the layout in depth.

Desired and built state

A standard repository separates deciding what a Dist should contain from producing the files that clients read.

  • Desired membership is the package set selected for each Dist, after filters and version limits.
  • A Generation is one completed build of the repository, with a manifest of every file it produced. The latest one is the built state, the state clients see.
flowchart LR
  input["sow add / sow rm"] --> desired["Desired membership"]
  desired -- "sow build" --> built["Built Generation<br/>pool/ + dists/"]
  built -- "sow publish TARGET" --> target["Publication target<br/>directory or R2"]

add and rm normally update membership and trigger a build. For a batch, pass --skip on each change and run sow build once at the end. Clients keep reading the old indexes until the build switches each affected Dist. Also run sow build after editing filters, architectures, or signing in sow.yml.

A build writes new metadata; packages stay in the shared pool, so keeping history is cheap. These commands work with built state:

Command Use
sow status See whether a build is pending, and whether the tree is ready_to_copy
sow check Verify package bytes, indexes, signatures, and the recorded manifest, without changing anything
sow changes [BASE_GENERATION] List the files that changed between a recorded Generation and the current one
sow publish TARGET Upload the current build to a configured target, changed files only

Repository state

sow status sums up a standard repository in one word:

State Meaning Next action
clean Desired membership and configuration match the built output sow check, then publish
dirty Membership or configuration changed since the last build sow build, then sow check
recovering An interrupted operation is waiting to be finished Run the command the error names; see recovery
error Recorded state and files disagree Read the error and sow log

A dirty repository still serves its previous build, so clients are never left without a working index while you prepare the next one. SOW records each change before applying it, which is why recovery is usually a matter of rerunning a command; see Transactions and recovery.

Continue