Did I Already Install Postgres?

1. Check if the psql client existsβ
psql --version
If installed, youβll see something like:
psql (PostgreSQL) 15.3
If not installed:
command not found
2. Check if the postgres service existsβ
systemctl status postgresql
- If installed + running β youβll see
active (running) - If installed but stopped β
inactive - If not installed β βUnit postgresql.service could not be foundβ
3. Check installed packages (more definitive)β
dpkg -l | grep postgres
This will list anything like:
postgresql
postgresql-15
postgresql-client-15
π This is the most reliable βis it installed at allβ check.
4. Check if the binary exists directlyβ
which psql
- If installed β
/usr/bin/psql - If not β no output
5. Bonus: check if a server is actually runningβ
pg_isready
- If running β
accepting connections - If not β
no response
Quick mental model (very you-friendly)β
psqlβ βcan I talk to postgres?βsystemctlβ βis postgres running as a service?βdpkgβ βis postgres installed at all?β
Comments
No comments yet. Be the first!