The default pig repo add pigsty pgdg will add the PGDG repo and PIGSTY repo to your system.
While the following command will backup & wipe your existing repo and add all require repo to your system.
pig repo add all --ru # This will OVERWRITE all existing repo with node,pgdg,pigsty repo
There’s a brutal version of repo add: repo set, which will overwrite you existing repo (-r) by default.
And you can recover you old repos at /etc/apt/backup or /etc/yum.repos.d/backup.
Install PostgreSQL
You can also install PostgreSQL kernel packages with
pig ext install pg17 # install PostgreSQL 17 kernels (all but devel)pig ext install pg16-simple # install PostgreSQL 16 kernels with minimal packagespig ext install pg15 -y # install PostgreSQL 15 kernels with auto-confirmpig ext install pg14=14.3 # install PostgreSQL 14 kernels with an specific minor versionpig ext install pg13=13.10 # install PostgreSQL 13 kernels
You can link the installed PostgreSQL to the system path with:
pig ext link pg17 # create /usr/pgsql soft links, and write it to /etc/profile.d/pgsql.sh. /etc/profile.d/pgsql.sh # reload the path and take effect immediately
You can also use other package alias, it will translate to corresponding package on your OS distro
and the $v will be replaced with the active or given pg version number, such as 17, 16, etc…
pig will use the default postgres installation in your active PATH,
but you can install extension for a specific installation with -v (when using the PGDG convention),
or passing any pg_config path for custom installation.
pig ext install pg_duckdb -v 16# install the extension for pg16pig ext install pg_duckdb -p /usr/lib/postgresql/17/bin/pg_config # specify a pg17 pg_config
Install a specific Version
You can also install PostgreSQL kernel packages with:
pig ext install pgvector=0.7.0 # install pgvector 0.7.0pig ext install pg16=16.5 # install PostgreSQL 16 with a specific minor version
Beware the APT repo may only have the latest minor version for its software (and require the full version string)
Search Extension
You can perform fuzzy search on extension name, description, and category.
$ pig ext ls olap
INFO[14:48:13] found 13 extensions matching 'olap':
Name State Version Cate Flags License Repo PGVer Package Description
---- ----- ------- ---- ------ ------- ------ ----- ------------ ---------------------
citus avail 13.0.1 OLAP -dsl-- AGPL-3.0 PIGSTY 14-17 citus_17* Distributed PostgreSQL as an extension
citus_columnar avail 11.3-1 OLAP -ds--- AGPL-3.0 PIGSTY 14-17 citus_17* Citus columnar storage engine
columnar n/a 11.1-11 OLAP -ds--- AGPL-3.0 PIGSTY 13-16 hydra_17* Hydra Columnar extension
pg_analytics avail 0.3.4 OLAP -ds-t- PostgreSQL PIGSTY 14-17 pg_analytics_17 Postgres for analytics, powered by DuckDB
pg_duckdb avail 0.2.0 OLAP -dsl-- MIT PIGSTY 14-17 pg_duckdb_17* DuckDB Embedded in Postgres
pg_mooncake avail 0.1.2 OLAP ------ MIT PIGSTY 14-17 pg_mooncake_17* Columnstore Table in Postgres
duckdb_fdw avail 1.0.0 OLAP -ds--r MIT PIGSTY 13-17 duckdb_fdw_17* DuckDB Foreign Data Wrapper
pg_parquet avail 0.2.0 OLAP -dslt- PostgreSQL PIGSTY 14-17 pg_parquet_17 copy data between Postgres and Parquet
pg_fkpart avail 1.7 OLAP -d---- GPL-2.0 PIGSTY 13-17 pg_fkpart_17 Table partitioning by foreign key utility
pg_partman avail 5.2.4 OLAP -ds--- PostgreSQL PGDG 13-17 pg_partman_17* Extension to manage partitioned tables by time or ID
plproxy avail 2.11.0 OLAP -ds--- BSD 0-Clause PIGSTY 13-17 plproxy_17* Database partitioning implemented as procedural language
pg_strom avail 5.2.2 OLAP -ds--x PostgreSQL PGDG 13-17 pg_strom_17* PG-Strom - big-data processing acceleration using GPU and NVME
tablefunc added 1.0 OLAP -ds-tx PostgreSQL CONTRIB 13-17 postgresql17-contrib functions that manipulate whole tables, including crosstab
(13 Rows)(State: added|avail|n/a,Flags: b= HasBin, d= HasDDL, s= HasSolib, l= NeedLoad, t= Trusted, r= Relocatable, x= Unknown)
You can use the -v 16 or -p /path/to/pg_config to find extension availability for other PostgreSQL installation.
Print Extension Summary
You can get extension metadata with pig ext info subcommand:
$ pig ext info pg_duckdb
╭────────────────────────────────────────────────────────────────────────────╮
│ pg_duckdb │
├────────────────────────────────────────────────────────────────────────────┤
│ DuckDB Embedded in Postgres │
├────────────────────────────────────────────────────────────────────────────┤
│ Extension : pg_duckdb │
│ Alias : pg_duckdb │
│ Category : OLAP │
│ Version : 0.3.1 │
│ License : MIT │
│ Website : https://github.com/duckdb/pg_duckdb │
│ Details : https://pigsty.io/ext/olap/pg_duckdb │
├────────────────────────────────────────────────────────────────────────────┤
│ Extension Properties │
├────────────────────────────────────────────────────────────────────────────┤
│ PostgreSQL Ver │ Available on: 17, 16, 15, 14 │
│ CREATE : Yes │ CREATE EXTENSION pg_duckdb; │
│ DYLOAD : Yes │ SET shared_preload_libraries='pg_duckdb' │
│ TRUST : No │ require database superuser to install │
│ Reloc : No │ Schemas: [] │
│ Depend : No │ │
├────────────────────────────────────────────────────────────────────────────┤
│ RPM Package │
├────────────────────────────────────────────────────────────────────────────┤
│ Repository │ PIGSTY │
│ Package │ pg_duckdb_$v* │
│ Version │ 0.3.1 │
│ Availability │ 17, 16, 15, 14 │
├────────────────────────────────────────────────────────────────────────────┤
│ DEB Package │
├────────────────────────────────────────────────────────────────────────────┤
│ Repository │ PIGSTY │
│ Package │ postgresql-$v-pg-duckdb │
│ Version │ 0.3.1 │
│ Availability │ 17, 16, 15, 14 │
├────────────────────────────────────────────────────────────────────────────┤
│ Known Issues │
├────────────────────────────────────────────────────────────────────────────┤
│ el8 │
├────────────────────────────────────────────────────────────────────────────┤
│ Additional Comments │
├────────────────────────────────────────────────────────────────────────────┤
│ broken on el8 (libstdc++ too low), conflict with duckdb_fdw │
╰────────────────────────────────────────────────────────────────────────────╯
List Repo
You can list all available repo / module (repo collection) with pig repo list:
Why would we need yet another package manager? especially for Postgres extensions?
Ever wished installing or upgrading PostgreSQL extensions didn’t feel like digging through outdated readmes, cryptic configure scripts, or random GitHub forks & patches?
The painful truth is that Postgres’s richness of extension often comes at the cost of complicated setups—especially if you’re juggling multiple distros or CPU architectures.
Enter Pig, a Go-based package manager built to tame Postgres and its ecosystem of 400+ extensions in one fell swoop.
TimescaleDB, Citus, PGVector, 20+ Rust extensions, plus every must-have piece to self-host Supabase —
Pig’s unified CLI makes them all effortlessly accessible. It cuts out messy source builds and half-baked repos,
offering version-aligned RPM/DEB packages that work seamlessly across Debian, Ubuntu, and RedHat flavors, as well as x86 & ARM arch. No guesswork, no drama.
Instead of reinventing the wheel, Pig piggyback your system’s native package manager (APT, YUM, DNF) and follow official PGDG packaging conventions to ensure a glitch-free fit.
That means you don’t have to choose between “the right way” and “the quick way”; Pig respects your existing repos, aligns with standard OS best practices, and fits neatly alongside other packages you already use.
Ready to give your Postgres superpowers without the usual hassle?
Check out GitHub for documentation, installation steps, and a peek at its massive extension list.
Then, watch your local Postgres instance transform into a powerhouse of specialized modules—no black magic is required.
If the future of Postgres is unstoppable extensibility,
Pig is the genie that helps you unlock it. Honestly, nobody ever complained that they had too many extensions.
pig ext list [query]# list & search extension pig ext info [ext...]# get information of a specific extensionpig ext status [-v]# show installed extension and pg statuspig ext add [ext...]# install extension for current pg versionpig ext rm [ext...]# remove extension for current pg versionpig ext update [ext...]# update extension to the latest versionpig ext import [ext...]# download extension to local repopig ext link [ext...]# link postgres installation to pathpig ext upgrade # fetch the latest extension catalog
The pig can also be used as a cli tool for Pigsty - the battery-include free PostgreSQL RDS.
Which brings HA, PITR, Monitoring, IaC, and all the extensions to your PostgreSQL cluster.
pig sty init # install pigsty to ~/pigsty pig sty boot # install ansible and other pre-deps pig sty conf # auto-generate pigsty.yml config filepig sty install # run the install.yml playbook
You can use the pig sty subcommand to bootstrap pigsty on current node.
5 - Repository Administration
How to manage repositories with pig repo subcommand?
The pig repo command is a comprehensive tool for managing package repositories.
It provides functionality to manage, add, remove, create and interact with os software repos.
It works on both RPM-based (EL) and Debian-based systems.
Overview
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)Usage:
pig repo [command]Aliases:
repo, r
Examples:
Get Started: https://pigsty.io/ext/pig/
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 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.tgzAvailable Commands:
add add new repository
boot bootstrap repo from offline package
cache create offline package from local repo
create create local YUM/APT repository
info get repo detailed information
list print available repo list
rm remove repository
set wipe and overwrite repository
status show current repo status
update update repo cache
Flags:
-h, --help helpfor repo
Global Flags:
--debug enable debug mode
-i, --inventory string config inventory path
--log-level string log level: debug, info, warn, error, fatal, panic (default "info") --log-path string log file path, terminal by default
Examples
List available repo and add PGDG & Pigsty repo, then update local repo cache.
# list available modulespig repo list
# add PGDG & Pigsty repopig repo add pgdg pigsty
# yum makecache or apt updatepig repo update
You’ll have to update repo metadata cache after adding new repo, you can either use the dedicate pig repo update command or use the -u|--update flag in pig repo add command.
If you wish to WIPE all the existing repo before adding new repo, you can use the extra -r|--remove flag, or use the dedicate pig repo set subcommand instead of pig repo add.
pig repo add all --remove # REMOVE all existing repo and add node, pgdg, pigsty repo and update repo cachepig repo add -r # same as above, and missing repo/module will use the default `all` alias to add node, pgdg, pigsty repopig repo set# same as above, set is a shortcut for `add --remove`, REMOVED repo files are backupped to `/etc/yum.repos.d/backup` or `/etc/apt/sources.list.d/backup`
The most brutal but reliable way to setup repo for PostgreSQL installation is to wipe all existing repo and add all the required repo with:
pig repo set -u # wipe all existing repo and add all the required repo and update repo cache
Modules
In pigsty, all repos are organized into modules, a module is a collection of repos.
Module names may maps to different real repos on different OS distro, major version and architecture, and geo region.
Pigsty will handle all the details, you can list all repos & modules with pig repo list.
Usually these 3 modules are required to install PostgreSQL & all the extensions:
pgdg: Official PostgreSQL Repo, with PG kernel packages, utils, and 100+ extensions.
pigsty: Pigsty Extension Repo, with 200+ extra extensions and utils.
node: Operating System Default Repo, which brings all the libraries and dependencies for PostgreSQL.
There’s a convient pesudo module alias all which includes all the 3 essential modules above.
You can add all of them with pig repo add all, or a even simpler abbreviation: pig repo add.
repo list
Lists available repository modules and repositories that can be added to the current system.
print available repo list
Usage:
pig repo list [flags]
Aliases:
list, l, ls
Examples:
pig repo list # list available repos on current system
pig repo list all # list all unfiltered repo raw data
Flags:
-h, --help help for list
Available repos are defined in the cli/repo/assets/repo.yml,
if you wish to modify the repo list, you can do so by adding your own repo.yml file to ~/.pig/repo.yml.
repo add
Adds repository configuration files to the system.
add new repository
Usage:
pig repo add [flags]Aliases:
add, a, append
Examples:
pig repo add # = pig repo add all pig repo add all # add node,pgsql,infra repo (recommended) pig repo add all -u # add above repo and update repo cache (or: --update) pig repo add all -r # add all repo, remove old repos (or: --remove) pig repo add pigsty --update # add pigsty extension repo and update repo cache pig repo add pgdg --update # add pgdg official repo and update repo cache pig repo add pgsql node --remove # add os + postgres repo, remove old repos pig repo add infra # add observability, grafana & prometheus stack, pg bin utils(Beware that system repo management require sudo / root privilege) available repo modules:
- all : pgsql + node + infra (recommended) - pigsty : PostgreSQL Extension Repo (default) - pgdg : PGDG the Official PostgreSQL Repo (official) - node : operating system official repo (el/debian/ubuntu) - pgsql : pigsty + pgdg (all available pg extensions)# check available repo & modules with pig repo listFlags:
-h, --help helpfor add
--region string region code (default|china) -r, --remove remove existing repo before adding new repo
-u, --update run apt update or dnf makecache
This command:
Verifies if specified modules exist and translate to real repos according to
region, distro, os major version, arch
If -r|--remove flag is provided, it will move the existing repo to backup folder:
/etc/yum.repos.d/backup for EL systems
/etc/apt/sources.list.d/backup for Debian systems
Creates repo files in the system’s repository directory
/etc/yum.repos.d/<module>.repo for EL systems
/etc/apt/sources.list.d/<module>.list for Debian systems
If -u|--update flag is provided, it will run apt update or dnf makecache to update the repo cache.
If not running as root, sudo privilege is required.
repo set
Same as repo add <...> --remove, remove existing repo before adding new repo.
wipe and overwrite repository
Usage:
pig repo set[flags]Aliases:
set, overwrite
Examples:
pig repo set all # set repo to node,pgsql,infra (recommended) pig repo set all -u # set repo to above repo and update repo cache (or --update) pig repo set pigsty --update # set repo to pigsty extension repo and update repo cache pig repo set pgdg --update # set repo to pgdg official repo and update repo cache pig repo set infra # set repo to observability, grafana & prometheus stack, pg bin utils(Beware that system repo management require sudo/root privilege)Flags:
-h, --help helpforset --region string region code
-u, --update run apt update or dnf makecache
If not running as root, sudo privilege is required.
repo update
Update repo cache, same as apt update or yum makecache.
If not running as root, sudo privilege is required.
repo rm
Removes repository files from the system.
remove repository
Usage:
pig repo rm [flags]Aliases:
rm, remove
Examples:
pig repo rm # remove (backup) all existing repo to backup dir pig repo rm all --update # remove module 'all' and update repo cache pig repo rm node pigsty -u # remove module 'node' & 'pigsty' and update repo cacheFlags:
-h, --help helpfor rm
-u, --update run apt update or dnf makecache
It will remove the repo files from the system, and if -u|--update flag is provided, it will run apt update or dnf makecache to update the repo cache after removing the repo files.
Before removing files, the command creates a backup of existing repository configurations.
If not running as root, sudo privilege is usually required.
repo status
Print the system repo directory and list available repos with system package manager.
show current repo status
Usage:
pig repo status [flags]Aliases:
status, s, st
Flags:
-h, --help helpfor status
repo info
Provides detailed information about specific repositories or modules.
get repo detailed information
Usage:
pig repo info [flags]Aliases:
info, i
Flags:
-h, --help helpfor info
Example:
#-------------------------------------------------Name : pgdg
Summary : PGDG
Available : Yes (debian d12 amd64)Module : pgsql
OS Arch : [x86_64, aarch64]OS Distro : deb [11,12,20,22,24]Meta : trusted=yes
Base URL : http://apt.postgresql.org/pub/repos/apt/ ${distro_codename}-pgdg main
china : https://mirrors.tuna.tsinghua.edu.cn/postgresql/repos/apt/ ${distro_codename}-pgdg main
# default repo content# pgdg PGDGdeb [trusted=yes] http://apt.postgresql.org/pub/repos/apt/ bookworm-pgdg main
# china mirror repo content# pgdg PGDGdeb [trusted=yes] https://mirrors.tuna.tsinghua.edu.cn/postgresql/repos/apt/ bookworm-pgdg main
It will print the repo information for the given repo name or module name. And regional mirrors are also supported.
repo create
Creates a local YUM/APT repository in specified directories
create local YUM/APT repository
Usage:
pig repo create [path...]Aliases:
create, cr
Examples:
pig repo create # create repo on /www/pigsty by default pig repo create /www/mssql /www/b # create repo on multiple locations(Beware that system repo management require sudo/root privilege)
Default directory:/www/pigsty
This command:
Creates the directory structure if it doesn’t exist
Create local repo with repo utils (make sure they are installed on the system)
createrepo_c for EL systems
dpkg-dev for Debian systems
If not running as root, read/write permission on that directory is required.
repo cache
Creates a compressed tarball of repository contents for offline use.
You can create a tarball on created local repo, and use it to boot a new system from offline package.
repo cache
create offline package from local repo
create offline package from local repo
Usage:
pig repo cache [flags]Aliases:
cache, c
Examples:
pig repo cache # create /tmp/pkg.tgz offline package from /www/pigsty pig repo cache -f # force overwrite existing package pig repo cache -d /srv # overwrite default content dir /www to /srv pig repo cache pigsty mssql # create the tarball with both pigsty & mssql repo pig repo c -f # the simplest use case to make offline package(Beware that system repo management require sudo/root privilege)Flags:
-d, --dir string source repo path (default "/www/") -h, --help helpfor cache
-p, --path string offline package path (default "/tmp/pkg.tgz")
repo boot
Bootstraps a local repository from an offline package.
bootstrap repo from offline package
Usage:
pig repo boot [flags]Aliases:
boot, b, bt
Examples:
pig repo boot # boot repo from /tmp/pkg.tgz to /www pig repo boot -p /tmp/pkg.tgz # boot repo from given package path pig repo boot -d /srv # boot repo to another directory /srvFlags:
-d, --dir string target repo path (default "/www/") -h, --help helpfor boot
-p, --path string offline package path (default "/tmp/pkg.tgz")
Parameters:
offline_package: Path to the tarball created by pig repo cache
target_directory: Directory to extract repositories to (default: /www)
Example:
pig repo boot /tmp/pkg.tgz /www
This command:
Extracts the tarball to the target directory
Sets up local repository configuration
Updates repository metadata
6 - Extension Administration
How to manage repositories with pig ext subcommand?
The pig ext command is a comprehensive tool for managing PostgreSQL extensions.
It allows users to search, install, remove, update, and manage PostgreSQL extensions and even kernel packages.
Overview
pig ext - Manage PostgreSQL Extensions
pig repo add -ru # add all repo and update cache (brute but effective) pig ext add pg17 # install optional postgresql 17 package pig ext list duck # search extension in catalog pig ext scan -v 17# scan installed extension for pg 17 pig ext add pg_duckdb # install certain postgresql extensionUsage:
pig ext [command]Aliases:
ext, e, ex, pgext, extension
Examples:
pig ext list [query]# list & search extension pig ext info [ext...]# get information of a specific extension pig ext status [-v]# show installed extension and pg status pig ext add [ext...]# install extension for current pg version pig ext rm [ext...]# remove extension for current pg version pig ext update [ext...]# update extension to the latest version pig ext import [ext...]# download extension to local repo pig ext link [ext...]# link postgres installation to path pig ext upgrade # upgrade to the latest extension catalogAvailable Commands:
add install postgres extension
import import extension packages to local repo
info get extension information
link link postgres to active PATH
list list & search available extensions
rm remove postgres extension
scan scan installed extensions for active pg
status show installed extension on active pg
update update installed extensions for current pg version
upgrade upgrade extension catalog to the latest version
Flags:
-h, --help helpfor ext
-p, --path string specify a postgres by pg_config path
-v, --version int specify a postgres by major version
Global Flags:
--debug enable debug mode
-i, --inventory string config inventory path
--log-level string log level: debug, info, warn, error, fatal, panic (default "info") --log-path string log file path, terminal by default
Use "pig ext [command] --help"for more information about a command.
Examples
To install postgres extensions, you’ll have to setup the repo first:
pig repo add pgdg pigsty -u # gental way to add pgdg and pigsty repopig repo set -u # brute way to remove and add all required repos
Then you can search, and install PostgreSQL extensions:
Check extension list for available extensions and their names.
When no PostgreSQL version is specified, the tool will try to detect the active PostgreSQL installation from pg_config in your PATH
PostgreSQL can be specified either by major version number (-v) or by pg_config path (-p).
if -v is given, pig will use the well-known default path of PGDG kernel packages for the given version.
- On EL distros, it’s /usr/pgsql-$v/bin/pg_config for PG$v,
- On DEB distros, it’s /usr/lib/postgresql/$v/bin/pg_config for PG$v, etc.
if -p is given, pig will use the pg_config path to find the PostgreSQL installation.
The extension manager supports different package formats based on the underlying operating system:
RPM packages for RHEL/CentOS/Rocky Linux/AlmaLinux
DEB packages for Debian/Ubuntu
Some extensions may have dependencies that will be automatically resolved during installation.
Use the -y flag with caution as it will automatically confirm all prompts.
Pigsty assumes you already have installed the official PGDG kernel packages, if not, you can install them with:
List and search available extensions in the extension catalog.
list & search available extensions
Usage:
pig ext list [query][flags]Aliases:
list, l, ls, find
Examples:
pig ext list # list all extensions pig ext list postgis # search extensions by name/description pig ext ls olap # list extension of olap category pig ext ls gis -v 16# list gis category for pg 16
You can update to the latest extension catalog with: pig ext upgrade it will download the latest extension catalog data to ~/.pig/pigsty.csv.
ext info
Display detailed information about specific extensions.
pig ext info [ext...]
Examples:
pig ext info postgis # Show detailed information about PostGISpig ext info timescaledb # Show information about TimescaleDB
$pigextinfopostgis# Show detailed information about PostGIS╭────────────────────────────────────────────────────────────────────────────╮│postgis│├────────────────────────────────────────────────────────────────────────────┤│PostGISgeometryandgeographyspatialtypesandfunctions│├────────────────────────────────────────────────────────────────────────────┤│Extension:postgis││Alias:postgis││Category:GIS││Version:3.5.2││License:GPL-2.0││Website:https://git.osgeo.org/gitea/postgis/postgis││Details:https://pigsty.io/gis/postgis│├────────────────────────────────────────────────────────────────────────────┤│ExtensionProperties│├────────────────────────────────────────────────────────────────────────────┤│PostgreSQLVer│Availableon:17,16,15,14,13││CREATE:Yes│CREATEEXTENSIONpostgis;││DYLOAD:No│noneedtoloadsharedlibraries││TRUST:No│requiredatabasesuperusertoinstall││Reloc:No│Schemas:[]││Depend:No││├────────────────────────────────────────────────────────────────────────────┤│RequiredBy│├────────────────────────────────────────────────────────────────────────────┤│-postgis_topology││-postgis_raster││-postgis_sfcgal││-postgis_tiger_geocoder││-pgrouting││-pointcloud_postgis││-h3_postgis││-mobilitydb││-documentdb│├────────────────────────────────────────────────────────────────────────────┤│RPMPackage│├────────────────────────────────────────────────────────────────────────────┤│Repository│PGDG││Package│postgis35_$v*││Version│3.5.2││Availability│17,16,15,14,13│├────────────────────────────────────────────────────────────────────────────┤│DEBPackage│├────────────────────────────────────────────────────────────────────────────┤│Repository│PGDG││Package│postgresql-$v-postgis-3postgresql-$v-postgis-3-scripts││Version│3.5.2││Availability│17,16,15,14,13│╰────────────────────────────────────────────────────────────────────────────╯
status - Show Installed Extensions
Display the status of installed extensions for the active PostgreSQL instance.
pig ext status [-c]
Options:
-c, --contrib: Include contrib extensions in the results
Examples:
pig ext status # Show installed extensionspig ext status -c # Show installed extensions including contrib onespig ext status -v 16# Show installed extensions for PostgreSQL 16
ext scan
Scan the active PostgreSQL instance for installed extensions.
pig ext scan [-v version]
It will scan the postgres extension folder to find all the actually installed extensions.
Link a PostgreSQL installation to the system PATH.
link postgres to active PATH
Usage:
pig ext link <-v pgver|-p pgpath> [flags]Aliases:
link, ln
Examples:
pig ext link 16# link pgdg postgresql 16 to /usr/pgsql pig ext link /usr/pgsql-16 # link specific pg to /usr/pgsql pig ext link /u01/polardb_pg # link polardb pg to /usr/pgsql pig ext link null|none|nil|nop|no # unlink current postgres installFlags:
-h, --help helpfor link
Examples:
pig ext link 17# Link PostgreSQL 17 to /usr/pgsqlpig ext link 16# Link PostgreSQL 16 to /usr/pgsqlpig ext link /usr/pgsql-16 # Link from a specific path to /usr/pgsqlpig ext link null # Unlink current PostgreSQL installation
upgrade
Update the extension catalog to the latest version.
pig ext upgrade
7 - Pigsty Administration
How to manage pigsty with pig sty subcommand?
Overview
The pig can also be used as a cli tool for Pigsty - the battery-include free PostgreSQL RDS.
Which brings HA, PITR, Monitoring, IaC, and all the extensions to your PostgreSQL cluster.
pig sty -Init (Download), Bootstrap, Configure, and Install Pigsty
pig sty init [-pfvd]# install pigsty (~/pigsty by default) pig sty boot [-rpk]# install ansible and prepare offline pkg pig sty conf [-civrsxn]# configure pigsty and generate config pig sty install # use pigsty to install & provisioning env (DANGEROUS!) pig sty get # download pigsty source tarball pig sty list # list available pigsty versionsUsage:
pig sty [command]Aliases:
sty, s, pigsty
Examples:
Get Started: https://pigsty.io/docs/setup/install/
pig sty init # extract and init ~/pigsty pig sty boot # install ansible & other deps pig sty conf # generate pigsty.yml config file pig sty install # run pigsty/install.yml playbookAvailable Commands:
boot Bootstrap Pigsty
conf Configure Pigsty
get download pigsty available versions
init Install Pigsty
install run pigsty install.yml playbook
list list pigsty available versions
Flags:
-h, --help helpfor sty
You can use the pig sty subcommand to bootstrap pigsty on current node.
sty init
pig sty init
-p | --path : where to install, ~/pigsty by default
-f | --force : force overwrite existing pigsty dir
-v | --version : pigsty version, embedded by default
-d | --dir : download directory, /tmp by default
Usage:
pig sty init [flags]Aliases:
init, i
Examples:
pig sty init # install to ~/pigsty with embedded version pig sty init -f # install and OVERWRITE existing pigsty dir pig sty init -p /tmp/pigsty # install to another location /tmp/pigsty pig sty init -v 3.3 # get & install specific version v3.3.0 pig sty init 3# get & install specific version v3 latestFlags:
-d, --dir string pigsty download directory (default "/tmp") -f, --force overwrite existing pigsty (false by default) -h, --help helpfor init
-p, --path string target directory (default "~/pigsty") -v, --version string pigsty version string
Configure pigsty with ./configure
pig sty conf
[-c|--conf <name> # [meta|dual|trio|full|prod][--ip <ip>]# primary IP address (skip with -s)[-v|--version <pgver> # [17|16|15|14|13][-r|--region <region> # [default|china|europe][-s|--skip]# skip IP address probing[-x|--proxy]# write proxy env from environment[-n|--non-interactive]# non-interactively modeCheck https://pigsty.io/docs/setup/install/#configure for details
Usage:
pig sty conf [flags]Aliases:
conf, c, configure
Examples:
pig sty conf # use the default conf/meta.yml config pig sty conf -c rich -x # use the rich.yml template, add your proxy env to config pig sty conf -c supa --ip=10.9.8.7 # use the supa template with 10.9.8.7 as primary IP pig sty conf -c full -v 16# use the 4-node full template with pg16 as default pig sty conf -c oss -s # use the oss template, skip IP probing and replacement pig sty conf -c slim -s -r china # use the 2-node slim template, designate china as regionFlags:
-c, --conf string config template name
-h, --help helpfor conf
--ip string primary ip address
-n, --non-interactive configure non-interactive
-p, --proxy configure proxy env
-r, --region string upstream repo region
-s, --skip skip ip probe
-v, --version string postgres major version
How to setup building infrastructure with pig build subcommand?
pig build is a powerful command-line tool that simplifies the entire workflow of building and managing PostgreSQL extensions - from setting up the build environment to compiling extensions across different operating systems.
# Initialize repositories and toolspig build repo
pig build tool
pig build spec
# For Rust-based extensionspig build rust
# Download standard extensionspig build get std # download all tarballspig build get citus timescaledb # download specific tarballs# Build specific extensionspig build ext citus
Build Workflow
A typical workflow for building PostgreSQL extensions with pig build:
Set up repositories: pig build repo
Install build tools: pig build tool
(Optional) Set up proxy: pig build proxy id@host:port
(Optional, for Rust extensions) Set up Rust: pig build rust
Initialize build specs: pig build spec
Download source code: pig build get [prefixes]
Build extensions: pig build ext [extname...]
Notes
The build process differs between EL and DEB-based distributions
Some commands may require sudo privileges to install system packages
For Rust-based extensions, set up the Rust environment first
Proxy setup is optional and only needed in environments with restricted internet access
OS Support
The pig build command supports:
EL distributions: RHEL, Rocky, CentOS (tested on versions 8 and 9)
DEB distributions: Debian (tested on versions 12), Ubuntu (tested on versions 22.04 and 24.04)
May have MacOS support via homebrew in the future
build repo
Aliases: r
Adding required upstream repo for building PostgreSQL extensions
by running the repository add command with update and remove flags enabled.
pig build repo
build tool
Aliases: t
Installs the build tools required for compiling PostgreSQL extensions.
pig build tool
Parameters:
mode: The installation mode (default: “mini”)
Available modes depend on the operating system and distribution
This command installs necessary build dependencies including:
Downloads source code tarballs for PostgreSQL extensions.
pig build get [prefixes|all|std]
Parameters:
std: Download standard packages (excluding large ones, default behavior)
all: Download all available source code tarballs (for batch building)
[prefixes]: One or more prefixes to filter the packages to download
Downloaded files are stored in:
EL: ~/rpmbuild/SOURCES/
DEB: ~/deb/tarball/
Example:
pig build get std # get standard packages (except for pg_duckdb/pg_mooncake/omnigres/plv8, too large)pig build get all # get all available source code tarballspig build get pg_mooncake # get pg_mooncake source codepig build get pg_duckdb # get pg_duckdb source codepig build get omnigres # get omnigres source codepig build get plv8 # get plv8 source codepig build get citus # get citus source codepig build get timescaledb # get timescaledb source codepig build get hydra # get hydra source codepig build get pgjwt # get pgjwt source code....
build ext
Aliases: e
Builds PostgreSQL extensions using the appropriate build environment for the current operating system.
pig build ext [extname...]
Parameters:
extname: One or more extension names to build
For each extension, the command:
Changes to the appropriate build directory (~/rpmbuild/BUILD or ~/deb/build)
Runs the make command with the extension name (e.g. make citus)
Reports success or failure for each extension build
It actually leverages the make <ext> command in the spec repo to build the extension.
build proxy
Aliases: p
Sets up a proxy server for accessing external resources, useful in environments with restricted internet access.
This is purely optional, and you dont’t need to it if you don’t have any connection problems.
pig build proxy [id@host:port][local]
Parameters:
id@host:port: The remote v2ray proxy specification in the format user-id@host:port
local: The local address for v2ray to bind to (default: “127.0.0.1:12345”)
This command:
Installs proxy software if not already present (/usr/local/bin/v2ray)
Configures the proxy with specified remote and local settings
Creates environment setup scripts in /etc/profile.d/proxy.sh
Configures the proxy service
Tests the proxy connectivity via curl google
You can load the proxy environment variables by running:
. /etc/profile.d/proxy.sh
After setup, you can use these following aliases:
po: Enable proxy (set proxy environment variables in your current shell session)