Skip to content

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.