Skip to content

pig repo

Manage software repositories with pig repo

The pig repo command is a comprehensive package repository manager. It can add, remove, create, and manage repositories on RPM systems (RHEL/CentOS/Rocky/Alma) and Debian systems (Debian/Ubuntu).

pig repo - Manage Linux APT/YUM Repo

  pig repo list                    # available repo list             (info)
  pig repo info   [repo|module...] # show repo info                  (info)
  pig repo status                  # show current repo status        (info)
  pig repo add    [repo|module...] # add repo and modules            (root)
  pig repo rm     [repo|module...] # remove repo & modules           (root)
  pig repo update                  # update repo pkg cache           (root)
  pig repo create                  # create repo on current system   (root)
  pig repo boot                    # boot repo from offline package  (root)
  pig repo cache                   # cache repo as offline package   (root)

Examples:
  pig repo add -ru                 # add all repo and update cache (brute but effective)
  pig repo add pigsty -u           # gentle version, only add pigsty repo and update cache
  pig repo add node pgdg pigsty    # essential repo to install postgres packages
  pig repo add all                 # all = node + pgdg + pigsty
  pig repo add all extra           # extra module has non-free and some 3rd repo for certain extensions
  pig repo add all -m              # prefer the bundled China-region mirrors
  pig repo update                  # update repo cache
  pig repo create                  # update local repo /www/pigsty meta
  pig repo boot                    # extract /tmp/pkg.tgz to /www/pigsty
  pig repo cache                   # cache /www/pigsty into /tmp/pkg.tgz
CommandDescriptionNotes
repo listPrint available repositories and modules
repo infoShow repository details
repo statusShow current repository status
repo addAdd repositoriesRequires sudo or root
repo setClear, overwrite, and update repositoriesRequires sudo or root
repo rmRemove repositoriesRequires sudo or root
repo updateUpdate repository cacheRequires sudo or root
repo createCreate local YUM/APT repositoryRequires sudo or root
repo cacheCreate offline package from local repoRequires sudo or root
repo bootBootstrap repository from offline packageRequires sudo or root
repo reloadRefresh repository catalog

Quick Start

# Method 1: clean existing repositories, add all required repos, and update cache (recommended)
pig repo add all --remove --update    # remove old repos, add all required repos, update cache

# Method 1 variant: one step
pig repo set                          # = pig repo add all --remove --update

# Method 2: gentle mode - only add required repos and keep current repo configuration
pig repo add pgsql                    # add PGDG and Pigsty PGSQL repositories
pig repo add pigsty --region=china    # add Pigsty repositories with China region
pig repo add pgdg   --region=europe   # add PGDG repositories with Europe region
pig repo add infra  --region=default  # add INFRA repositories with default region
pig repo add all -m                   # explicitly select the bundled China-region mirrors

# If the commands above did not use -u|--update, run this as an extra step
pig repo update                       # update system package cache

Modules

In pig, APT/YUM repositories are organized as modules: groups of repositories serving a specific purpose.

ModuleDescriptionRepository List
allAll core modules required to install PGnode + infra + pgsql
pgsqlPGDG + Pigsty PG extensionspigsty-pgsql + pgdg
pigstyPigsty Infra + PGSQL repositoriespigsty-infra, pigsty-pgsql
pgdgPGDG official repositoriespgdg-common, pgdg14-18
nodeLinux system repositoriesbase, updates, extras, epel, baseos, appstream…
infraInfrastructure component repositoriespigsty-infra, nginx, docker-ce
dockerDocker repositorydocker-ce
betaPostgreSQL 19 beta repositoriespgdg19-beta, pgdg-beta
extraPGDG non-free and third-party extensionspgdg-extras, timescaledb, citus
groongaPGroonga repositorygroonga
mssqlWiltonDB repository (deprecated)babelfish
perconaPercona PG + PG_TDEpercona
llvmLLVM toolchain repositoryllvm
kubeKubernetes repositorykubernetes
grafanaGrafana repositorygrafana
haproxyHAProxy repositorieshaproxyd, haproxyu
redisRedis repositoryredis
mongoMongoDB repositorymongo
mysqlMySQL repositorymysql
clickClickHouse repositoryclickhouse
gitlabGitLab repositorygitlab-ce, gitlab-ee

Pig also includes APT/DNF repositories for other databases and systems such as redis, kubernetes, grafana, clickhouse, gitlab, haproxy, mongodb, and mysql.

In general, node (Linux system repositories) and pgsql (PGDG + Pigsty) are required for PostgreSQL installation. The infra repository is optional and contains tools, IvorySQL kernel packages, and similar components. The special all module adds all required repositories at once and is a suitable starting point for most users.

pig repo add all      # add node, pgsql, and infra repositories
pig repo add          # default to the all module when no argument is given
pig repo set          # set clears/backups existing definitions and overwrites with new repo definitions

Repository Definitions

The full repository definition bundled with Pigsty is in cli/repo/assets/repo.yml.

You can create ~/.pig/repo.yml to explicitly modify and override pig’s repository definitions. When editing repository definitions, you can add extra regional mirror URLs under baseurl, such as China or Europe mirrors. When --region is specified, pig first looks for the matching regional URL and falls back to the default URL if the region is unavailable. Since v1.7.0, -m|--mirror explicitly selects the bundled china definitions, including pigsty.cc and the maintained domestic mirrors; it no longer rewrites PGDG URLs through a runtime proxy.

Ordinary EL repositories keep native DNF module filtering. Only definitions that explicitly declare module_hotfixes=1—notably Pigsty and PGDG repositories—override module streams, and the key is removed when rendering EL7 YUM configuration.

repo list

pig repo list lists all repository modules available on the current system.

pig repo list                # list repositories available on current system
pig repo list all            # list all repositories without filtering

repo info

Show detailed information for specific repositories or modules, including URLs, metadata, regional mirrors, and .repo / .list repository file content.

pig repo info pgdg               # show pgdg module information
pig repo info pigsty pgdg        # show multiple modules
pig repo info all                # show all modules

repo status

Show current repository configuration on the system.

pig repo status

repo add

Add repository configuration files to the system. Requires root/sudo privileges.

pig repo add pgdg                # add PGDG repository
pig repo add pgdg pigsty         # add multiple repositories
pig repo add all                 # add all required repositories (pgdg + pigsty + node)
pig repo add pigsty -u           # add and update cache
pig repo add all -r              # remove existing repos before adding
pig repo add all -ru             # remove, add, and update (full reset)
pig repo add pgdg --region=china # use China mirror
pig repo add pgsql -m            # explicitly select the China-region mirrors

Options:

  • -r|--remove: remove existing repositories before adding new ones
  • -u|--update: run package cache update after adding repositories
  • -m|--mirror: explicitly select the bundled china repository definitions
  • --region <region>: use regional mirror repositories (default / china / europe)
PlatformModule Location
EL/etc/yum.repos.d/<module>.repo
Debian/etc/apt/sources.list.d/<module>.list

repo set

Equivalent to repo add --remove --update. It clears existing repositories, sets up new ones, then updates cache.

pig repo set                     # replace with default repositories
pig repo set pgdg pigsty         # replace with selected repositories and update
pig repo set all --region=china  # use China mirror
pig repo set -m                  # explicitly select the China-region mirrors

repo set supports the same --region and -m|--mirror region selection as repo add; it always uses overwrite semantics, equivalent to repo add all --remove --update.

repo rm

Remove repository configuration files and back them up.

pig repo rm                      # remove all repositories
pig repo rm pgdg                 # remove selected repository
pig repo rm pgdg pigsty -u       # remove and update cache
PlatformBackup Location
EL/etc/yum.repos.d/backup/
Debian/etc/apt/sources.list.d/backup/

repo update

Update package-manager cache to reflect repository changes.

pig repo update                  # update package cache
PlatformEquivalent Command
ELdnf makecache
Debianapt update

repo create

Create a local package repository for offline installation.

pig repo create                  # Linux: /www/pigsty; macOS: current directory
pig repo create /srv/repo        # create at custom location

The current implementation prefers sow when it is available in PATH. On Linux, the SOW backend runs the equivalent of the following with sudo for every target directory:

sow create --pigsty --timeout 10m -- /absolute/repository/path

On macOS, SOW is required, runs without sudo, and the default target is the current directory. On Linux, if sow is not installed, EL falls back to createrepo_c and Debian/Ubuntu falls back to dpkg-scanpackages from dpkg-dev. If neither the preferred backend nor the platform fallback is available, pig repo create fails. A SOW execution error is returned directly rather than retried through the legacy backend. The 10m timeout limits the wait for SOW’s directory lock; it does not cap repository indexing time.

SOW’s --pigsty transaction:

  1. Scans only top-level regular .rpm and .deb files—no recursion and no symlink following.
  2. Removes parsed 32-bit x86 packages (RPM i386/i486/i586/i686, DEB i386) and packages whose binary name is exactly patroni with upstream version exactly 3.0.4.
  3. Builds the applicable RPM/DEB metadata atomically and writes repo_complete last. The marker contains SHA-256 hashes for remaining top-level packages, sorted by basename.

Non-package files and directories are left untouched; malformed package candidates or conflicting package coordinates make the SOW transaction fail closed. The legacy fallback has different cleanup and metadata semantics and writes an MD5 package list to repo_complete. After either backend exits, PIG requires repo_complete to exist as a regular file, but it does not validate the marker contents or hashes. Consumers that use the marker as a delivery gate should perform that verification themselves.

repo cache

Create a compressed tarball of repository contents for offline distribution.

pig repo cache                   # default: /www to /tmp/pkg.tgz
pig repo cache -d /srv           # custom source directory

Options:

  • -d, --dir: source directory, default /www/
  • -p, --path: output path, default /tmp/pkg.tgz

repo boot

Extract and set up a local repository from an offline package.

pig repo boot                    # default: /tmp/pkg.tgz to /www
pig repo boot -p /mnt/pkg.tgz    # custom package path
pig repo boot -d /srv            # custom target directory

Options:

  • -p, --path: package path, default /tmp/pkg.tgz
  • -d, --dir: target directory, default /www/

repo reload

Refresh repository metadata from GitHub to the latest version.

pig repo reload                  # refresh repository catalog

The updated file is placed in ~/.pig/repo.yml.

Was this page helpful?