PostgreSQL Setup and Configuration#
Every PostgreSQL deployment boils down to three things: get the binary running, configure who can connect, and tune the memory settings.
Installation Methods#
Package Managers#
On Debian/Ubuntu, use the official PostgreSQL APT repository:
sudo apt install -y postgresql-common
sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh
sudo apt install -y postgresql-16On macOS: brew install postgresql@16 && brew services start postgresql@16
On RHEL/Fedora:
sudo dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-9-x86_64/pgdg-redhat-repo-latest.noarch.rpm
sudo dnf install -y postgresql16-server
sudo /usr/pgsql-16/bin/postgresql-16-setup initdb
sudo systemctl enable --now postgresql-16Config files live at /etc/postgresql/16/main/ (Debian) or /var/lib/pgsql/16/data/ (RHEL).