Skip to content
Download all
  1. Install from PGDG, run a supported major version, and keep it on the latest minor.
  2. Four install steps, always in order: repository, packages, initdb, start and enable.
  3. PostgreSQL runs as postgres, never as root. Switch with sudo su - postgres.
  4. Changes go to the WAL first, the data files later. Never touch pg_wal by hand.
  5. Remote access needs three gates open: firewall, listen_addresses, pg_hba.conf.
Term Meaning
PGDG PostgreSQL Global Development Group, the community that builds PostgreSQL and its package repository
Major / minor version 18 is the major (features), .7 is the minor (fixes)
Database cluster All the databases one server manages, stored in one data directory
PGDATA The data directory, /var/lib/pgsql/18/data
initdb The program that creates a new data directory
postmaster The first server process. Listens on 5432 and starts all others
Backend The process that serves one client connection
psql PostgreSQL's command-line client
Role A database user, such as postgres or appuser
shared_buffers Shared memory cache of 8 kB data pages
WAL Write-ahead log. Every change is written here first
Checkpoint The moment changed pages in memory are written to the data files
pg_hba.conf The file that decides who may connect, from where, and how
peer / scram-sha-256 Login methods: trust the Linux user name / check a password
What is the difference between upgrading from 18.6 to 18.7 and from 17 to 18?

18.6 to 18.7 is a minor upgrade: stop, install the new packages, start. The data files stay the same. 17 to 18 is a major upgrade: the data format changes, so you need pg_upgrade or a dump and restore.

A client gets "Connection refused". Which two things do you check first?

That the service is running (systemctl status postgresql-18) and that listen_addresses covers the network (ss -tlnp | grep 5432 shows 0.0.0.0:5432, not only 127.0.0.1:5432).

Why does PostgreSQL write to the WAL before the data files?

So a committed change is safe on disk before the client gets "OK". If the server crashes before the data file is updated, PostgreSQL replays the WAL at startup.

Your server has 11 PostgreSQL processes but only one client is connected. Why?

Only one of them is the client backend. The others are the postmaster and the background processes: checkpointer, background writer, walwriter, autovacuum launcher, 3 io workers, the logical replication launcher and the logger.

Was this page helpful?

Thanks. Glad it helped.

Thanks for telling us. Email the instructor what was missing, or ask in class.