postgresql
Installation
SKILL.md
Identity
- Unit:
postgresql@16-main.service(Debian/Ubuntu),postgresql-16.service(RHEL/Fedora) - Config (Debian):
/etc/postgresql/16/main/postgresql.conf,/etc/postgresql/16/main/pg_hba.conf - Config (RHEL):
/var/lib/pgsql/16/data/postgresql.conf,/var/lib/pgsql/16/data/pg_hba.conf - Data dir (Debian):
/var/lib/postgresql/16/main/ - Data dir (RHEL):
/var/lib/pgsql/16/data/ - Logs (Debian):
/var/log/postgresql/postgresql-16-main.log - Logs (RHEL):
journalctl -u postgresql-16, or$PGDATA/log/if logging_collector=on - Postgres superuser:
postgres(OS user and DB superuser — separate concepts) - Install (Debian):
apt install postgresql-16 - Install (RHEL):
dnf install postgresql16-server && postgresql-16-setup initdb
Key Operations
| Operation | Command |
|---|---|
| Service status | systemctl status postgresql@16-main (Debian) / systemctl status postgresql-16 (RHEL) |
| Reload config | sudo systemctl reload postgresql@16-main or SELECT pg_reload_conf(); in psql |
| Connect as postgres | sudo -u postgres psql |
Related skills