Build an APT Repository
You have DEBs for Debian or Ubuntu hosts and want apt install to work against your own
repository, with the same update behavior clients expect from a public archive. This
tutorial builds an APT standard repository, which
SOW maintains in a workspace: one suite, trixie, with amd64 and arm64 indexes over a
single package pool, and an apt client that installs from it.
You need:
- SOW 0.9.0 (Installation) and Python 3 for the preview server.
- DEB 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, a Debian or Ubuntu host with
apt. 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. trixie is a Dist, one
named package set; its name becomes the Suites value in the client’s source configuration.
Set membership policy
If you need filtering or version limits, edit the generated sow.yml. This example keeps
one version per package name and architecture and excludes debug symbol packages:
Then validate it:
Configuration uses the canonical names x86_64 and aarch64 (amd64 and arm64 are
accepted as aliases), and SOW writes the Debian amd64 and arm64 indexes from them.
Architecture-independent all packages enter both views.
Add DEBs
add stores each accepted package once in the pool and builds the indexes. The public
tree is:
/srv/sow/pigsty/
- pool/
dists/trixie/
- Release
main/
binary-amd64/
- Packages
- Packages.gz
- by-hash/SHA256/
- binary-arm64/
The Filename paths in Packages are relative to the repository root, so serve the
complete pigsty/ directory. Release declares Acquire-By-Hash: yes, and each index is
also stored under by-hash/SHA256/. During an update, a client that already fetched the
previous Release still downloads the Packages file that matches it.
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 APT
On the host running the preview, save this as /etc/apt/sources.list.d/pigsty.sources.
Use arm64 in Architectures on ARM64 clients. For a remote client, publish the
repository first and use its public URL:
URIs points at the repository root, not at dists/. Trusted: yes accepts this
unsigned example; Sign your repository replaces it with
Signed-By.
Refresh and query it:
The repository works when apt update completes and apt-cache policy lists trixie/main
as a package source. After the preview, remove the test source file and stop the Python
server.
Publish the repository
To give other hosts access, use sow publish with a filesystem
or R2 target. It uploads packages and indexes before it updates Release and its
signatures. The same tutorial covers manual delivery to isolated hosts.
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 trixie --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
aptverifies it throughSigned-By. - Serve and publish the repository to other hosts.
- Platforms & Integrations lists the tested clients.