# PostgreSQL mirror (pkg.shecan.ir)

> Mirror of the PostgreSQL Global Development Group repositories: apt.postgresql.org (Debian/Ubuntu) and download.postgresql.org yum (RHEL-compatible).

- Upstream: apt.postgresql.org, download.postgresql.org
- Mirror URLs: <https://mirror-postgresql.pkg.shecan.ir/apt/>, <https://mirror-postgresql.pkg.shecan.ir/yum/>
- Clients: apt, dnf, yum
- Service status: <https://pkg.shecan.ir/status.json> (key `postgresql`; up/down, refreshed every minute)
- Guide (Persian, HTML): <https://pkg.shecan.ir/mirrors/postgresql/>
- JSON: <https://pkg.shecan.ir/api/v1/mirrors/postgresql.json>

## Limitations

- apt and dnf still verify the PGDG signatures.

## Setup

Every block below is the exact text of the Persian guide. Unless marked otherwise it is run against the live mirror in a disposable container on every catalog change; "checked by hand" blocks cannot run in a container. Change a machine only with its owner's permission: back up existing configuration first, merge into existing files instead of overwriting them, and keep the "Undo" step at hand.

### apt: persistent (user- or system-wide configuration)

Run, Ubuntu or Debian (linux)

```sh
sudo install -d /usr/share/postgresql-common/pgdg
sudo curl -fsSLo /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc https://mirror-postgresql.pkg.shecan.ir/apt/ACCC4CF8.asc
. /etc/os-release
echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://mirror-postgresql.pkg.shecan.ir/apt $VERSION_CODENAME-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list
sudo apt update && sudo apt install -y postgresql-17
```

Undo / restore the default, Ubuntu or Debian (linux)

```sh
sudo rm -f /etc/apt/sources.list.d/pgdg.list /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc
sudo apt update
```

### dnf, yum: persistent (user- or system-wide configuration)

Configuration file, EL 9 (linux): `/etc/yum.repos.d/pgdg.repo`

```ini
[pgdg17]
name=PostgreSQL 17 - $basearch
baseurl=https://mirror-postgresql.pkg.shecan.ir/yum/17/redhat/rhel-9-$basearch
enabled=1
gpgcheck=1
gpgkey=https://mirror-postgresql.pkg.shecan.ir/yum/keys/PGDG-RPM-GPG-KEY-RHEL

[pgdg-common]
name=PostgreSQL common RPMs - $basearch
baseurl=https://mirror-postgresql.pkg.shecan.ir/yum/common/redhat/rhel-9-$basearch
enabled=1
gpgcheck=1
gpgkey=https://mirror-postgresql.pkg.shecan.ir/yum/keys/PGDG-RPM-GPG-KEY-RHEL
```

Undo / restore the default, EL 9 (linux)

```sh
sudo rm -f /etc/yum.repos.d/pgdg.repo
sudo dnf clean all
```

### dnf: persistent (user- or system-wide configuration)

Run, EL 9 (linux) (checked by hand)

```sh
sudo dnf -qy module disable postgresql
sudo dnf install -y postgresql17-server
```
