# Download PG Exporter

> Choose, install, configure, enable, and verify PG Exporter packages, archives, containers, Pigsty automation, or source builds

---

LLMS index: [llms.txt](/llms.txt)

---

PG Exporter 1.4.1 is available as managed Linux packages, direct RPM/DEB files, release archives for Linux/macOS/Windows, a multi-architecture container image, Pigsty automation, and source. Choose by lifecycle ownership, not by feature set: every route runs the same exporter and declarative collectors.

<div class="alert alert-info" role="alert"><div class="h4 alert-heading" role="heading" aria-level="4">Product and artifact names</div>


The product name is **PG Exporter**. The Linux package is `pg-exporter`; the executable, service, configuration file, and container repository retain the compatibility name `pg_exporter`.
</div>


<div id="td-nav-cards-0588a98b5a89b0c290232d2304555a27-2" class="td-content-cards" style="--td-card-columns: 4">
<article id="td-nav-card-0588a98b5a89b0c290232d2304555a27-nav-cards-2-0" class="td-content-card">
  <div class="td-content-card__body">
    <div class="td-content-card__head"><i class="fa-solid fa-box-archive td-content-card__icon" aria-hidden="true"></i><a class="td-content-card__title" href="#repository-packages">Linux packages</a><span class="td-content-card__badge">Recommended</span></div><p class="td-content-card__description">APT/YUM lifecycle, systemd unit, merged config, and /etc/default/pg_exporter.</p>
  </div>
</article>

<article id="td-nav-card-0588a98b5a89b0c290232d2304555a27-nav-cards-2-1" class="td-content-card">
  <div class="td-content-card__body">
    <div class="td-content-card__head"><i class="fa-solid fa-file-zipper td-content-card__icon" aria-hidden="true"></i><a class="td-content-card__title" href="#github-release-artifacts">Release artifacts</a></div><p class="td-content-card__description">Versioned RPM, DEB, and Linux/macOS/Windows archives with SHA256 checksums.</p>
  </div>
</article>

<article id="td-nav-card-0588a98b5a89b0c290232d2304555a27-nav-cards-2-2" class="td-content-card">
  <div class="td-content-card__body">
    <div class="td-content-card__head"><i class="fa-brands fa-docker td-content-card__icon" aria-hidden="true"></i><a class="td-content-card__title" href="#container-image">Container</a></div><p class="td-content-card__description">Pinned amd64/arm64 image for Docker, Podman, Compose, or an orchestrator.</p>
  </div>
</article>

<article id="td-nav-card-0588a98b5a89b0c290232d2304555a27-nav-cards-2-3" class="td-content-card">
  <div class="td-content-card__body">
    <div class="td-content-card__head"><i class="fa-solid fa-code-branch td-content-card__icon" aria-hidden="true"></i><a class="td-content-card__title" href="#pigsty">Pigsty or source</a></div><p class="td-content-card__description">A complete monitoring stack through Pigsty, or a tagged build you own end to end.</p>
  </div>
</article>

</div>


## Choose an installation path

| Method | Best fit | Lifecycle owner | Service integration |
|:---|:---|:---|:---|
| Pigsty APT/YUM repository | Long-lived Linux hosts | OS package manager | Included systemd unit and defaults |
| Direct RPM/DEB | Pinned or offline Linux promotion | Your artifact pipeline | Included systemd unit and defaults |
| Release archive | Minimal install, macOS/Windows, custom layout | You | Service examples included; manual wiring |
| Container image | Container platforms | Container runtime/orchestrator | Restart and secrets policy are yours |
| Pigsty | PostgreSQL plus a complete observability stack | Pigsty automation | Integrated with metrics, rules, and dashboards |
| Source | Development, auditing, custom builds | You | Manual |
{.full-width}

For long-running Linux services, start with the repository package. It gives upgrades, file ownership, `/etc/default/pg_exporter`, the merged collector configuration, and systemd behavior as one managed unit.

## Repository packages

The `pigsty-infra` repository publishes `pg-exporter` for common EL and Debian/Ubuntu platforms.




<ul class="nav nav-tabs" id="tabs-3" role="tablist"><li class="nav-item" role="presentation"><button class="nav-link active" id="tabs-03-00-tab" data-bs-toggle="tab" data-bs-target="#tabs-03-00" role="tab" data-td-tp-persist="apt · debian / ubuntu" aria-controls="tabs-03-00" aria-selected="true">APT · Debian / Ubuntu</button></li><li class="nav-item" role="presentation"><button class="nav-link" id="tabs-03-01-tab" data-bs-toggle="tab" data-bs-target="#tabs-03-01" role="tab" data-td-tp-persist="yum · rhel / rocky / alma" aria-controls="tabs-03-01" aria-selected="false">YUM · RHEL / Rocky / Alma</button></li></ul>

<div class="tab-content" id="tabs-3-content"><div class="tab-body tab-pane fade show active" id="tabs-03-00" role="tabpanel" aria-labelledby="tabs-03-00-tab" tabindex="0"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">sudo tee /etc/apt/sources.list.d/pigsty-infra.list &gt; /dev/null <span class="s">&lt;&lt;&#39;EOF&#39;
</span></span></span><span class="line"><span class="cl"><span class="s">deb [trusted=yes] https://repo.pigsty.io/apt/infra generic main
</span></span></span><span class="line"><span class="cl"><span class="s">EOF</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">sudo apt update
</span></span><span class="line"><span class="cl">sudo apt install -y pg-exporter</span></span></code></pre></div></div><div class="tab-body tab-pane fade" id="tabs-03-01" role="tabpanel" aria-labelledby="tabs-03-01-tab" tabindex="0"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">sudo tee /etc/yum.repos.d/pigsty-infra.repo &gt; /dev/null <span class="s">&lt;&lt;&#39;EOF&#39;
</span></span></span><span class="line"><span class="cl"><span class="s">[pigsty-infra]
</span></span></span><span class="line"><span class="cl"><span class="s">name=Pigsty Infra for $basearch
</span></span></span><span class="line"><span class="cl"><span class="s">baseurl=https://repo.pigsty.io/yum/infra/$basearch
</span></span></span><span class="line"><span class="cl"><span class="s">enabled=1
</span></span></span><span class="line"><span class="cl"><span class="s">gpgcheck=0
</span></span></span><span class="line"><span class="cl"><span class="s">module_hotfixes=1
</span></span></span><span class="line"><span class="cl"><span class="s">EOF</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">sudo yum makecache
</span></span><span class="line"><span class="cl">sudo yum install -y pg-exporter</span></span></code></pre></div></div>
</div>


The repository examples match the current Pigsty package channel. If your supply-chain policy requires signed package metadata, promote a verified release artifact into your own repository instead of weakening that policy on production hosts.

### Configure and enable the service {#enable-service}

The package installs:

- `/usr/bin/pg_exporter` — executable;
- `/etc/pg_exporter.yml` — merged collector configuration, preserved on upgrades;
- `/etc/default/pg_exporter` — process environment and options, preserved on upgrades;
- `pg_exporter.service` — systemd unit running as the `prometheus` user.

Create the [monitoring database role](/start/#create-monitoring-user), then set its connection URL:

```bash
sudoedit /etc/default/pg_exporter

# Set this value in the file; prefer .pgpass or a secret file in production.
PG_EXPORTER_URL='postgres://monitor@127.0.0.1:5432/postgres?sslmode=disable'
```

Enable, start, and verify the service:

```bash
sudo systemctl enable --now pg_exporter
sudo systemctl status pg_exporter
journalctl -u pg_exporter -n 50 --no-pager

curl -fsS http://127.0.0.1:9630/up
curl -fsS http://127.0.0.1:9630/metrics | grep '^pg_up '
```

Use `sslmode=verify-full` plus an explicit CA for remote production targets. The [deployment guide](/deploy/#monitoring-user-and-credentials) covers `.pgpass`, `PG_EXPORTER_URL_FILE`, HTTP TLS/authentication, and network exposure.

## GitHub release artifacts

The [v1.4.1 release](https://github.com/pgsty/pg_exporter/releases/tag/v1.4.1) contains RPM and DEB packages plus archives for Linux, macOS, and Windows. Linux supports amd64, arm64, and ppc64le; macOS supports amd64 and arm64; Windows provides amd64.





<ul class="nav nav-tabs" id="tabs-6" role="tablist"><li class="nav-item" role="presentation"><button class="nav-link active" id="tabs-06-00-tab" data-bs-toggle="tab" data-bs-target="#tabs-06-00" role="tab" data-td-tp-persist="deb package" aria-controls="tabs-06-00" aria-selected="true">DEB package</button></li><li class="nav-item" role="presentation"><button class="nav-link" id="tabs-06-01-tab" data-bs-toggle="tab" data-bs-target="#tabs-06-01" role="tab" data-td-tp-persist="rpm package" aria-controls="tabs-06-01" aria-selected="false">RPM package</button></li><li class="nav-item" role="presentation"><button class="nav-link" id="tabs-06-02-tab" data-bs-toggle="tab" data-bs-target="#tabs-06-02" role="tab" data-td-tp-persist="tar archive" aria-controls="tabs-06-02" aria-selected="false">Tar archive</button></li></ul>

<div class="tab-content" id="tabs-6-content"><div class="tab-body tab-pane fade show active" id="tabs-06-00" role="tabpanel" aria-labelledby="tabs-06-00-tab" tabindex="0"><p>Choose <code>ARCH=amd64</code>, <code>arm64</code>, or <code>ppc64le</code> to match the release filename:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nv">VERSION</span><span class="o">=</span>1.4.1
</span></span><span class="line"><span class="cl"><span class="nv">ARCH</span><span class="o">=</span>amd64
</span></span><span class="line"><span class="cl">curl -fLO <span class="s2">&#34;https://github.com/pgsty/pg_exporter/releases/download/v</span><span class="si">${</span><span class="nv">VERSION</span><span class="si">}</span><span class="s2">/pg-exporter_</span><span class="si">${</span><span class="nv">VERSION</span><span class="si">}</span><span class="s2">-1_</span><span class="si">${</span><span class="nv">ARCH</span><span class="si">}</span><span class="s2">.deb&#34;</span>
</span></span><span class="line"><span class="cl">sudo apt install <span class="s2">&#34;./pg-exporter_</span><span class="si">${</span><span class="nv">VERSION</span><span class="si">}</span><span class="s2">-1_</span><span class="si">${</span><span class="nv">ARCH</span><span class="si">}</span><span class="s2">.deb&#34;</span></span></span></code></pre></div><p>Continue with <a href="/download/#enable-service">service configuration</a>.</p>
</div><div class="tab-body tab-pane fade" id="tabs-06-01" role="tabpanel" aria-labelledby="tabs-06-01-tab" tabindex="0"><p><code>uname -m</code> returns the release architecture names <code>x86_64</code>, <code>aarch64</code>, or <code>ppc64le</code> on supported systems:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nv">VERSION</span><span class="o">=</span>1.4.1
</span></span><span class="line"><span class="cl"><span class="nv">ARCH</span><span class="o">=</span><span class="k">$(</span>uname -m<span class="k">)</span>
</span></span><span class="line"><span class="cl">curl -fLO <span class="s2">&#34;https://github.com/pgsty/pg_exporter/releases/download/v</span><span class="si">${</span><span class="nv">VERSION</span><span class="si">}</span><span class="s2">/pg-exporter-</span><span class="si">${</span><span class="nv">VERSION</span><span class="si">}</span><span class="s2">-1.</span><span class="si">${</span><span class="nv">ARCH</span><span class="si">}</span><span class="s2">.rpm&#34;</span>
</span></span><span class="line"><span class="cl">sudo dnf install <span class="s2">&#34;./pg-exporter-</span><span class="si">${</span><span class="nv">VERSION</span><span class="si">}</span><span class="s2">-1.</span><span class="si">${</span><span class="nv">ARCH</span><span class="si">}</span><span class="s2">.rpm&#34;</span></span></span></code></pre></div><p>Continue with <a href="/download/#enable-service">service configuration</a>.</p>
</div><div class="tab-body tab-pane fade" id="tabs-06-02" role="tabpanel" aria-labelledby="tabs-06-02-tab" tabindex="0"><p>Choose <code>OS=linux</code> or <code>darwin</code>; choose <code>ARCH=amd64</code>, <code>arm64</code>, or Linux <code>ppc64le</code>. Windows users download the <code>windows-amd64</code> archive and run <code>pg_exporter.exe</code> from their chosen directory.</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nv">VERSION</span><span class="o">=</span>1.4.1
</span></span><span class="line"><span class="cl"><span class="nv">OS</span><span class="o">=</span>linux
</span></span><span class="line"><span class="cl"><span class="nv">ARCH</span><span class="o">=</span>amd64
</span></span><span class="line"><span class="cl"><span class="nv">ARCHIVE</span><span class="o">=</span><span class="s2">&#34;pg_exporter-</span><span class="si">${</span><span class="nv">VERSION</span><span class="si">}</span><span class="s2">.</span><span class="si">${</span><span class="nv">OS</span><span class="si">}</span><span class="s2">-</span><span class="si">${</span><span class="nv">ARCH</span><span class="si">}</span><span class="s2">.tar.gz&#34;</span>
</span></span><span class="line"><span class="cl"><span class="nv">STAGE</span><span class="o">=</span><span class="s2">&#34;pg_exporter-</span><span class="si">${</span><span class="nv">VERSION</span><span class="si">}</span><span class="s2">-</span><span class="si">${</span><span class="nv">OS</span><span class="si">}</span><span class="s2">-</span><span class="si">${</span><span class="nv">ARCH</span><span class="si">}</span><span class="s2">&#34;</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">curl -fLO <span class="s2">&#34;https://github.com/pgsty/pg_exporter/releases/download/v</span><span class="si">${</span><span class="nv">VERSION</span><span class="si">}</span><span class="s2">/</span><span class="si">${</span><span class="nv">ARCHIVE</span><span class="si">}</span><span class="s2">&#34;</span>
</span></span><span class="line"><span class="cl">mkdir -p <span class="s2">&#34;</span><span class="si">${</span><span class="nv">STAGE</span><span class="si">}</span><span class="s2">&#34;</span>
</span></span><span class="line"><span class="cl">tar -xzf <span class="s2">&#34;</span><span class="si">${</span><span class="nv">ARCHIVE</span><span class="si">}</span><span class="s2">&#34;</span> -C <span class="s2">&#34;</span><span class="si">${</span><span class="nv">STAGE</span><span class="si">}</span><span class="s2">&#34;</span>
</span></span><span class="line"><span class="cl">sudo install -m <span class="m">0755</span> <span class="s2">&#34;</span><span class="si">${</span><span class="nv">STAGE</span><span class="si">}</span><span class="s2">/pg_exporter&#34;</span> /usr/local/bin/pg_exporter
</span></span><span class="line"><span class="cl">sudo install -m <span class="m">0644</span> <span class="s2">&#34;</span><span class="si">${</span><span class="nv">STAGE</span><span class="si">}</span><span class="s2">/pg_exporter.yml&#34;</span> /etc/pg_exporter.yml
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">pg_exporter --version</span></span></code></pre></div><p>Run it directly with <code>PG_EXPORTER_URL=... pg_exporter</code>, or adapt the included <code>package/pg_exporter.service</code> and <code>package/pg_exporter.default</code> examples to your paths.</p>
</div>
</div>


### Verify the download

Every release includes `checksums.txt`. Verify the files before installing or promoting them:

```bash
VERSION=1.4.1
curl -fLO "https://github.com/pgsty/pg_exporter/releases/download/v${VERSION}/checksums.txt"
sha256sum -c checksums.txt --ignore-missing
```

On macOS, use `shasum -a 256 <archive>` and compare it with the matching entry in `checksums.txt`.

## Container image

The official [`pgsty/pg_exporter`](https://hub.docker.com/r/pgsty/pg_exporter) image publishes amd64 and arm64 manifests. Pin the release tag for reproducible deployments:

```bash
docker run -d \
  --name pg_exporter \
  --restart unless-stopped \
  -p 127.0.0.1:9630:9630 \
  -e PG_EXPORTER_URL='postgres://monitor:S3cret@postgres:5432/postgres' \
  pgsty/pg_exporter:1.4.1

curl -fsS http://127.0.0.1:9630/up
curl -fsS http://127.0.0.1:9630/metrics | grep '^pg_up '
```

Mount a custom collector file only when you need one:

```bash
docker run -d \
  --name pg_exporter \
  --restart unless-stopped \
  -p 127.0.0.1:9630:9630 \
  -e PG_EXPORTER_URL_FILE=/run/secrets/pgurl \
  -v ./pgurl:/run/secrets/pgurl:ro \
  -v ./pg_exporter.yml:/etc/pg_exporter.yml:ro \
  pgsty/pg_exporter:1.4.1
```

<div class="alert alert-warning" role="alert"><div class="h4 alert-heading" role="heading" aria-level="4">Scratch image</div>


The image contains the static exporter, merged config, and license, but no shell or operating-system CA bundle. Mount the required CA explicitly when using `sslmode=verify-ca` or `verify-full`.
</div>


For Compose and Kubernetes examples, probes, secrets, and Prometheus wiring, continue to [Container and Kubernetes deployment](/deploy/#docker-deployment).

## Pigsty

[Pigsty](https://pigsty.io/) is the integrated route when you want PG Exporter together with a PostgreSQL distribution, Prometheus-compatible metrics storage, recording/alerting rules, and Grafana dashboards.

```bash
curl -fsSL https://repo.pigsty.io/get | bash
cd ~/pigsty
```

The bootstrap only obtains Pigsty; choose the appropriate inventory and deployment procedure before running it against any host. See the [Pigsty installation guide](https://pigsty.io/docs/setup/install/) and its existing PostgreSQL monitoring workflow.

## Build from source

Use the Go version declared by the tagged `go.mod`, then build the exact release source:

```bash
git clone https://github.com/pgsty/pg_exporter.git
cd pg_exporter
git checkout "v1.4.1"
make build

./pg_exporter --version
PG_EXPORTER_URL='postgres://monitor@127.0.0.1:5432/postgres' ./pg_exporter --dry-run
```

For a manual Unix install:

```bash
sudo install -m 0755 pg_exporter /usr/local/bin/pg_exporter
sudo install -m 0644 pg_exporter.yml /etc/pg_exporter.yml
```

Source builds do not create a service account or register a system service. If you need package-grade ownership and service behavior, use the RPM/DEB route or reproduce those controls deliberately.

## Activation checklist

Installation is complete only when the target can be scraped:

1. Create a least-privilege [monitoring role](/start/#create-monitoring-user).
2. Provide the connection through `--url`, `PG_EXPORTER_URL`, `PGURL`, or `PG_EXPORTER_URL_FILE`.
3. Run `pg_exporter --dry-run` and inspect [`/explain`](/api/#get-explain).
4. Verify `/up` and confirm `pg_up 1` at `/metrics`.
5. Add the exporter to [Prometheus-compatible scraping](/start/#hook-into-prometheus).
6. For production, review [credentials, TLS, HTTP exposure, systemd/container restart policy, and probes](/deploy/).

Need the complete artifact matrix or PostgreSQL/PgBouncer compatibility details? Use the [Installation reference](/install/) and [Compatibility matrix](/compatibility/).
