Setup current linux node, and download everything from the Internet
This is the multi-page printable view of this section. .
Installation
- 1: Quick Start
- 2: User Interface
- 3: Multi-Node
- 4: Offline Install
- 5: Minimal Install
- 6: Video Demo
Quick Start
Quick start: Prepare an ssh-accessible node with fresh installed Linux,
run as user with nopass ssh and sudo privileges:
Step 1
Download pigsty with:
Step 2
Configure the inventory file according to your need. (CHANGE PASSWORDS in the generated pigsty.yml)
Step 3
Install everything according to your config:
Pigsty Installed! Explore the User Interface, check port 5432 for Postgres Service, port 3000 for Grafana dashboards (admin / pigsty).
What’s Next?
- Access Postgres Service
- Explore Grafana Dashboards
- Create Biz Database and User
- Adding more nodes for real HA
- Get more PostgreSQL Extensions
Installation
Setup multiple nodes for real high-available production environment.
Bootstrap from a local offline package when internet is not available.
Install essential packages for HA Postgres Cluster only, no monitoring.
Preparation
Prepare node, network, storage, user, ssh, sudo, ansible, etc...
Check compatible linux distributions and availability matrix
Provision local linux virtual machines with vagrant / virtualbox
Provision cloud linux servers with terraform on cloud vendors
Reference
Provision cloud linux servers with terraform on cloud vendors
Describe the infra and clusters with declarative configs
Check compatible linux distributions and availability matrix
Security hardening and best practices for production environments
1 - Quick Start
This is a one-node installation guide, check Multi-Node for real HA production setup.
Short Version
Prepare an ssh-accessible node with Compatible Linux Distro,
run as user with nopass ssh and sudo:
Step 1
[**Download**](#download) pigsty with:
```bash
curl -fsSL https://repo.pigsty.io/get | bash -s v3.7.0; cd ~/pigsty;
```
Step 2
[**Configure**](#configure) the [`pigsty.yml`](/docs/config/inventory) inventory file according to
your need and environment.
```bash
./configure
```
Step 3
[**Install**](#install) everything according to your config:
```bash
./install.yml
```
Example: Singleton Installation on RockyLinux 9:
Prepare
Check Preparation for all the details, here’s a quick summary:
| Item | Requirement | Item | Requirement |
|---|---|---|---|
| Node | 1C1G at least, 2C2G recommended |
Spec | 1 node at least, 2 for semi-HA, 3+ for real HA |
| Disk | /data, main mount point, ext4/xfs |
Network | static IPv4 address |
| VIP | Optional L2 VIP | Domain | Optional local / public domain names |
| Kernel | Linux |
Distro | el8-10, d12/13, u22/24 x x86_64 / aarch64 |
| Locale | C.UTF-8 or C |
Firewall | port: 80 / 443 / 22 / 5432 |
| User | avoid using root & postgres |
Sudo | nopass sudo privilege |
| SSH | nopass via public key |
Accessible | ssh <ip|alias> sudo ls without error |
Download
(RECOMMENDED) You can get & extract the latest stable version of pigsty source with:
You can also install via git, pig, or download source & offline package tarball directly from GitHub.
pigsty/
Configure
The configure script will generate the pigsty.yml config file inventory with good defaults according to your environment and input.
It’s OPTIONAL, you can edit the pigsty.yml directly as the tutorial shows.
There are many Config Templates for your reference, here are some quick examples:
Let’s just do configure without any args, it may ask you for the primary IP if more than one is found.
This script will replace the IP placeholder 10.10.10.10 to the primary IPv4 address of current node.
Beware of this when you are configure pigsty manually. Check the generated pigsty.yml to proceed.
HEY! Don’t forget these passwords!
PLEASE CHANGE DEFAULT PASSWORDS in any serious deployment before install
Then change default passwords and make necessary adjustments, the final pigsty.yml may look like:
Just uncomment the following two parameters in pigsty.yml to make it looks like:
There are much more magic you can do with the config file, check the Configuration for details.
Install
Everything in Pigsty is described in config inventory: the pigsty.yml blueprint generated above.
Run the install.yml playbook to materialize it into reality.
If you see something like pgsql init done or grafana datasource meta, PLAY RECAP or simlar stuff in the output, it means the installation is complete!
Sometimes upstream repo (like linux / pgdg repo) may break, this do happen from time to time, and led to installation failure. You can use pre-made offline packages to address this issue.
Re-run this playbook entirely will nuke (wipe-out) the current deployment and create a new one!
If you have enough knowledge with ansible and know what you are doing, still do it with caution!
Once installed, you can explore the Interface and deploy More Nodes and more HA database clusters.
More
You can deploy & monitor More Clusters with pigsty: add definition to the Inventory and run:
Remember that most modules require the NODE module installed first. Check available modules for detail
2 - User Interface
Once installed, you’ll have the four core modules:
PGSQL, INFRA, NODE, and ETCD on current node.
You can access WebUI services from the following Ports directly (not recommended for prod). Or use local / public Domain Names to access them via Nginx Portal. SSL Certs can only be used with domains.
| Component | Port | Domain | Comment | Public Demo |
|---|---|---|---|---|
| Nginx | 80/443 |
h.pigsty |
Portal, Repo, HAProxy Admin | home.pigsty.io |
| Grafana | 3000 |
g.pigsty |
Grafana Dashboards | g.pgsty.com |
| Prometheus | 9058 |
p.pigsty |
Prometheus Web UI | p.pigsty.io |
| AlertManager | 9059 |
a.pigsty |
Alert Management | a.pigsty.io |
You can access the default PostgreSQL database (meta) @ default port 5432 via the following users and corresponding PGURL:
PostgreSQL
For personal usage, you could just use the default superuser and IP:Port to access PostgreSQL:
DBSU
The default database superuser is dbuser_dba, with DBUser.DBA as default password, use your own if changed.
| Username | dbuser_dba |
pg_admin_username |
|---|---|---|
| Password | DBUser.DBA |
pg_admin_password |
CLI
The built-in psql CLI is already configured with .pgpass and .pg_service.conf for the admin user
GUI
To access your database with graphical interface, you can use your favorite GUI tools, we also have some built-in templates.
| Name | Description | Pigsty Support |
|---|---|---|
| PgAdmin | Official PostgreSQL administration tool | Built-in Docker template, OSS |
| Supabase Studio | Fancy 3rd party UI for PostgreSQL management | Built-in Docker template, OSS |
| PgWeb | Lightweight web-based PostgreSQL client | Built-in Docker template, OSS |
| Bytebase | Schema migration tool with a good GUI | Built-in Docker template, OSS |
| DataGrip / IntelliJ | Professional database IDE with powerful features | Commercial / Community |
| Navicat | Popular commercial database management tool | Commercial |
| DBeaver | Open-source universal database GUI | OSS |
Defaults
You can define business Database and User. These config templates has some pre-defined examples for your reference.
For example, the default meta config template has pre-defined a meta database with Pigsty CMDB schema (optional) and a vector extension.
It defines dbuser_meta as business admin user with DDL privilege, and a dbuser_view as read-only viewer user.
Which means you can also access the meta database with these two users:
Production
To use HA PostgreSQL cluster in production environment, you’ll need to read the following documents to proceed:
In that case, your traffic is usually distributed by haproxy and pooled by pgbouncer before reaching the database.

Grafana
Grafana is the platform for monitoring and observability, it listens on port 3000 by default:
- http://10.10.10.10:3000 (replace with your IP)
Pigsty support static local domain (fake) for web components, you can access Grafana via http://g.pigsty through Nginx
It’s advised to use domain names, Since you can expose all services via Nginx with domain names, and use SSL certs for them.
Default credential: admin:pigsty. If you have changed the default credentials, use your own.
| Username | admin |
grafana_admin_username |
|---|---|---|
| Password | pigsty |
grafana_admin_password |
You can check our public demo site to see what it looks like: https://g.pgsty.com

Pigsty issues self-signed SSL certs for local static domain names, but you’ll have to trust the self-signed CA in your browser.
Pigsty has support for using real domain names and SSL certs
Just replace domain entries in infra_portal, and use make cert to apply for real certs for free
3 - Multi-Node
There is a configuration Tutorial for expanding Pigsty from one node to multiple nodes. While the easiest way is always pre-planing everything and provisioning them in one-pass.
1-node Setup
We already illustrated the 1-node installation in the Quick Start section, which may be the simplest setup.
It is not advised to put all the eggs in one basket, but even this one-node setup can be used for production, as long as an external MinIO / S3 / NFS… is configured for PG as remote backup repo.
There are lots of 1-node config templates for your reference.
And provision VM with Vagrant meta.rb
or Terraform meta.tf.
2-node Setup
The semi-HA setup
A two-node setup enables database replication and semi-HA capabilities:
| ID | IP Address | NODE | PGSQL | INFRA | ETCD |
|---|---|---|---|---|---|
| 1 | 10.10.10.10 |
meta |
pg-meta-1 |
infra-1 |
etcd-1 |
| 2 | 10.10.10.11 |
node-1 |
pg-meta-2 |
While more robust than a single node setup, HA has limitations:
- No automatic failover if
node-1fails - manual promotion ofnode-2required - Automatic failover works if
node-2fails -node-1gets promoted automatically
This “semi-HA” setup can only auto-recover from specific node failures.
You can use the dual.yml config template, and provision required VM with:
Vagrant dual.rb to provision this environment.
3-node Setup
The true HA
A true HA setup that can automatically recover from any single node failure:
| ID | IP Address | NODE | PGSQL | INFRA | ETCD |
|---|---|---|---|---|---|
| 1 | 10.10.10.10 |
node-1 |
pg-meta-1 |
infra-1 |
etcd-1 |
| 2 | 10.10.10.11 |
node-2 |
pg-meta-2 |
infra-2 |
etcd-2 |
| 3 | 10.10.10.12 |
node-3 |
pg-meta-3 |
infra-3 |
etcd-3 |
You can use the trio.yml config template, and provision required VM with:
Vagrant trio.rb to provision this environment.
4-node Sandbox
This is a sandbox demo environment used in Pigsty, which has one infra node and three extra data nodes:
| ID | IP Address | NODE | PGSQL | INFRA | ETCD | MINIO |
|---|---|---|---|---|---|---|
| 1 | 10.10.10.10 |
meta |
pg-meta-1 |
infra-1 |
etcd-1 |
minio-1 |
| 2 | 10.10.10.11 |
node-1 |
pg-test-1 |
|||
| 3 | 10.10.10.12 |
node-2 |
pg-test-1 |
|||
| 4 | 10.10.10.13 |
node-3 |
pg-test-1 |
You can use the full.yml config template, and provision required VM with:
Vagrant full.rb or Terraform full.tf to provision this environment.
5-node Building
This pro.yml is a 5-node building environment which contains supported Linux distros.
| ID | IP Address | NODE | PGSQL | INFRA | ETCD |
|---|---|---|---|---|---|
| 1 | 10.10.10.8 |
el8 |
el8-1 |
infra-1 |
|
| 2 | 10.10.10.9 |
el9 |
el9-1 |
infra-2 |
etcd-2 |
| 3 | 10.10.10.12 |
u12 |
u12-1 |
infra-3 |
|
| 4 | 10.10.10.22 |
u22 |
u22-1 |
infra-4 |
|
| 5 | 10.10.10.24 |
u24 |
u24-1 |
infra-5 |
You can use the Vagrant pro.rb or Terraform pro.tf to provision this environment.
36-node Simulation
A production simulation environment (simu.yml) with 36 nodes covering all Pigsty components
| IP Address | SPEC | NODE | PGSQL | INFRA | ETCD | MINIO | REDIS |
|---|---|---|---|---|---|---|---|
10.10.10.10 |
8C32G | meta1 |
pg-meta-1 |
infra-1 |
|||
10.10.10.11 |
8C32G | meta2 |
pg-meta-2 |
infra-2 |
|||
10.10.10.12 |
2C4G | pg12 |
pg-v12-1 |
||||
10.10.10.13 |
2C4G | pg13 |
pg-v13-1 |
||||
10.10.10.14 |
2C4G | pg14 |
pg-v14-1 |
||||
10.10.10.15 |
2C4G | pg15 |
pg-v15-1 |
||||
10.10.10.16 |
2C4G | pg16 |
pg-v16-1 |
||||
10.10.10.17 |
2C4G | pg17 |
pg-v17-1 |
||||
10.10.10.18 |
2C4G | proxy1 |
|||||
10.10.10.19 |
2C4G | proxy2 |
|||||
10.10.10.21 |
2C4G | minio1 |
etcd-1 |
minio-1 |
redis-meta-1 |
||
10.10.10.22 |
2C4G | minio2 |
etcd-2 |
minio-2 |
redis-meta-2 |
||
10.10.10.23 |
2C4G | minio3 |
etcd-3 |
minio-3 |
redis-meta-3 |
||
10.10.10.24 |
2C4G | minio4 |
etcd-4 |
minio-4 |
redis-meta-4 |
||
10.10.10.25 |
2C4G | minio5 |
etcd-5 |
minio-5 |
redis-meta-5 |
||
10.10.10.40 |
1C2G | node40 |
pg-pitr-1 |
||||
10.10.10.41 |
1C2G | node41 |
pg-test-1 |
redis-test-1 |
|||
10.10.10.42 |
1C2G | node42 |
pg-test-2 |
redis-test-2 |
|||
10.10.10.43 |
1C2G | node43 |
pg-test-3 |
redis-test-3 |
|||
10.10.10.44 |
1C2G | node44 |
pg-test-4 |
redis-test-4 |
|||
10.10.10.45 |
1C2G | node45 |
pg-src-1 |
redis-src-1 |
|||
10.10.10.46 |
1C2G | node46 |
pg-src-2 |
redis-src-2 |
|||
10.10.10.47 |
1C2G | node47 |
pg-src-3 |
redis-src-3 |
|||
10.10.10.48 |
1C2G | node48 |
pg-dst-1 |
redis-dst-1 |
|||
10.10.10.49 |
1C2G | node49 |
pg-dst-2 |
redis-dst-2 |
|||
10.10.10.50 |
1C2G | node50 |
pg-citus0-1 |
||||
10.10.10.51 |
1C2G | node51 |
pg-citus0-2 |
||||
10.10.10.52 |
1C2G | node52 |
pg-citus1-1 |
||||
10.10.10.53 |
1C2G | node53 |
pg-citus1-2 |
||||
10.10.10.54 |
1C2G | node54 |
pg-citus2-1 |
||||
10.10.10.55 |
1C2G | node55 |
pg-citus2-2 |
||||
10.10.10.56 |
1C2G | node56 |
pg-citus3-1 |
||||
10.10.10.57 |
1C2G | node57 |
pg-citus3-2 |
||||
10.10.10.58 |
1C2G | node58 |
pg-citus4-1 |
||||
10.10.10.59 |
1C2G | node59 |
pg-citus4-2 |
||||
10.10.10.88 |
4C8G | test |
You can use the Vagrant simu.rb to provision this environment.
You can run the entire simulation on a real server (72C / 256G) with libvirt as VM provider with vagrant.
- 2 infra nodes, monitoring each other
- 2 dedicated proxy nodes that run haproxy
- 5-node etcd cluster which tolerates 2 node failures, and 5-node redis sentinel cluster
- 5-node minio cluster with 4 disks on each node
- 10 postgres clusters,
pg13-pg15,pg-src,pg-dst,pg-pitr,pg-test - 10-node citus cluster with 5 shards
- redis standalone cluster
redis-srcandredis-dst, and native clusterredis-test
4 - Offline Install
Pigsty install from Internet upstream by default, while some environments are isolated from the Internet. To address this issue, Pigsty supports offline installation from offline packages.
Step 1
Download the pigsty offline package, put it to `/tmp/pkg.tgz`
Step 2
Download the pigsty source package, extract it (assume `~/pigsty`)
Step 3
`cd ~/pigsty; ./bootstrap`, it will extract the pkg and use the local repo
Step 4
`vi ~/pigsty.yml`, overwrite [`node_repo_modules`](/docs/node/param#node_repo_modules) to `local` to use the local repo
Step 5
Run `./install.yml` as usual. it will install everything from the local repo.
What is offline package?
Offline package packs all the required RPM/DEB packages and their dependencies; it is essentially a snapshot tarball of local APT / YUM repo, taken after a normal installation.
You can find these packages from the GitHub release page, for example:
We usually release offline packages for the following linux distro, with the latest OS minor version.
| EL Distribution | Code | Arch | OS Code | Package |
|---|---|---|---|---|
| RockyLinux 9.6 | EL9 | x86_64 | el9.x86_64 |
pigsty-pkg-v3.7.0.el9.x86_64.tgz |
| Ubuntu 24.04.2 | U24 | x86_64 | u24.x86_64 |
pigsty-pkg-v3.7.0.u24.x86_64.tgz |
| Debian 12.11 | D12 | x86_64 | d12.x86_64 |
pigsty-pkg-v3.7.0.d12.x86_64.tgz |
| RockyLinux 9.6 | EL9 | x86_64 | el9.aarch64 |
pigsty-pkg-v3.7.0.el9.aarch64.tgz |
| Ubuntu 24.04.2 | U24 | x86_64 | u24.aarch64 |
pigsty-pkg-v3.7.0.u24.aarch64.tgz |
| Debian 12.11 | D12 | x86_64 | d12.aarch64 |
pigsty-pkg-v3.7.0.d12.aarch64.tgz |
https://github.com/pgsty/pigsty/releases/download/v3.7.0/pigsty-pkg-v3.7.0.el9.x86_64.tgz
Using offline package on lower minor version may have a chance of success, but it is not guaranteed.
Using Offline Package
Place the offline package at /tmp/pkg.tgz, navigate to the ~/pigsty directory and execute ./bootstrap to extract and use the offline package.
Pigsty will extract it to /www/pigsty, configure the system repository list to enable this repository, and install ansible from it.
Since Pigsty v3.6, most configuration templates no longer build local software repositories by default, but install packages directly from Internet upstream.
A few configuration templates such as rich and full still retain the old behavior — building local repositories first before using them.
If you want to use the extracted and configured offline package in your own configuration, please modify the following settings:
repo_enabled: Set this totrueto build local software repo (explicitly disabled in most templates)node_repo_modules: Set this tolocalto install from local software repo for all nodes in the env- In most templates, this parameter is now explicitly configured as:
node,infra,pgsql, which installs software packages directly from upstream repos. - Setting it to
localwill use the local repo alone, which is fastest and more reliable if applicable. - If you want to use both local and upstream repositories, you can set it to
local,node,infra,pgsql
- In most templates, this parameter is now explicitly configured as:
Pros and Cons
If you are using the exact same OS minor version above, using offline packages is advised.
- Official offline packages are tested.
- The easiest way to deliver on Internet isolated environment.
- Speed up the installation process by pre-download all packages in one-pass.
- The snapshot is ensured working without worrying about upstream dependency breakage.
- If OS minor version not match, OS rpm/deb packages may break
- It may not contain the latest updates and OS security patches.
Bootstrap
The bootstrap script will automatically detect /tmp/pkg.tgz and extract it to /www/pigsty by default.
It will also set up the os package manager repo file and install ansible and other utils.
Bootstrap will wipe-out existing repo by default to ensure only the required repos are installed.
You can find them in /etc/yum.repos.d/backup (EL) or /etc/apt/backup (debian / ubuntu)
You can use the -k|--keep parameter to keep the existing repo files intact:
Make offline package
If your OS choice is not in the default offline package offering list,
you can make your own offline package with the built-in cache.yml playbook.
Step 1
Find a node running exact same OS version with the Internet access
Step 2
Run standard [online installation procedure](/docs/install) (use the `rich` template: `configure -c rich`)
Step 3
`cd ~/pigsty; ./cache.yml`: make and fetch the offline package to `dist/${version}/`
Step 4
Copy the offline package to the environment without Internet access (ftp, scp, usb,...)
Since Pigsty v3.6, most configuration templates install packages directly from Internet upstream, rather than downloading to the admin node first to build a local repository and then installing from it. You can restore the previous default behavior by adjusting parameters, which is useful if you need to build your own offline packages:
repo_enabled: set totrueto build local software reponode_repo_modules: set tolocalto install from local repo
Some configuration templates, such as rich and full, still retain the old behavior — building local repositories first before using them, so no adjustment is needed.
We offer paid service to make offline packages for precise Linux major.minor versions. ($30)
Hybrid Approach
There’s a hybrid approach to using the offline package and do online install upon it. This could be useful if your OS repo is a local Intranet repo.
Let’s say you are using RockyLinux 9.5, but the official offline package is made for RockyLinux 9.6.
You can use the el9 offline packages, and run the make repo-build before the ./install.yml,
to force Pigsty to perform a repo build task (infra.repo).
If you want to use the latest version or resolve any dependency conflict, you can remove these rpm/deb and run make repo-build,
pigsty will re-download them from the upstream repo.
5 - Minimal Install
If you just want HA PostgreSQL itself, without monitoring, infra, etc…, consider the slim installation.
There’s no INFRA modules, no monitoring, no local repo Just ETCD & PGSQL and partial of NODE
Overview
To use slim installation, you need to:
Step 1
Use the `slim.yml` config template (`configure -c slim`)
Step 2
Run the `slim.yml` playbook instead of `install.yml`
Slim installation only installs these essential components:
| Component | Required | Description |
|---|---|---|
| patroni | REQUIRED | Bootstrap HA PostgreSQL cluster |
| etcd | REQUIRED | meta database dependency (DCS) for patroni |
| pgbouncer | OPTIONAL | Connection pooler for postgres |
| vip-manager | OPTIONAL | L2 VIP binding to postgres cluster leader |
| haproxy | OPTIONAL | Auto-routing service |
| chronyd | OPTIONAL | Time synchronization with NTP server |
| tuned | OPTIONAL | Node tuned template and kernel parameters management |
You can turn off the optional components, the only two required components are patroni and etcd.
Packages are directly installed from the Internet upstream repo, offline install is not applicable here.
Configure
Config file example: conf/slim.yml for slim installation:
Install
Use the slim.yml playbook instead of the install.yml playbook:
The slim.yml playbook is designed to replace the install.yml playbook for the minimal installations.
6 - Video Demo
Asciinema Videos: Vonng
Standard Install
Pigsty v3.6.0, RockyLinux 9.6, x86_64, Standard Installation, Link
This will use the default meta single-node configuration.
Rich Install
Pigsty v3.6.0, Ubuntu 24.04.2, x86_64, Rich Installation
Rich template has the following features enabled in addition to the standard installation:
- almost all available postgres extensions
- build local software repo for entire env (download before installing)
- 1 node minio used as central backup repo
- cluster stub for 3-node pg-test / ferret / redis
- stub for nginx, certs, and website self-hosting config
- detailed comments for database / user / service
Slim Install
Pigsty v3.6.0, Debian 12.11, aarch64, Slim Installation, Link
Postgres HA Cluster with essential modules, (with ETCD, without INFRA).
Offline Install
Pigsty v3.6.0, RockyLinux 9.6, aarch64, Slim Installation
Supabase
Pigsty v3.6.0, Ubuntu 24.04, x86_64, Install Supabase
Now let’s setup your domain name and HTTPS certificates
vi pigsty.yml
curl -fsSL https://repo.pigsty.cc/get | bash -s v3.6.0; cd ~/pigsty ./configure -c supabase # 使用 supabase 配置(请在 pigsty.yml 中更改凭据) vi pigsty.yml # 编辑域名、密码、密钥… ./install.yml # 安装 pigsty ./docker.yml # 安装 docker compose 组件 ./app.yml # 使用 docker 启动 supabase 无状态部分