Install PostgreSQL with apt install postgresql on Ubuntu or Homebrew on macOS. After installing, connect with psql to verify it works. Set a strong password for the postgres superuser immediately after installation.
Installing PostgreSQL
Ubuntu/Debian
sudo apt update
sudo apt install postgresql postgresql-contrib
macOS (Homebrew)
brew install postgresql
brew services start postgresql
Windows
Download the installer from postgresql.org/download/windows and follow the wizard.
Verify installation
psql --version
# postgresql 15.x