Install and connect to PostgreSQL
Choose a verifiable PostgreSQL 18 setup for Ubuntu, macOS, Windows, or containers
Docker quickstart
Create a disposable PostgreSQL 18 instance in minutes.
Linux packages and PGDG
Verify package names, versions, repositories, and security evidence by distribution.
Install on Ubuntu
Choose between distribution packages and the PostgreSQL Apt repository.
Install on macOS
Compare Homebrew, Postgres.app, and the graphical installer.
Install on Windows
Use the EDB installer linked by the PostgreSQL project and verify the service.
Choose the outcome first
| Outcome | Recommended starting point |
|---|---|
| Learning, tests, CI | Docker: pin the version and remove the whole environment cleanly |
| Persistent local development | OS package manager or a trusted installer |
| Production | A managed cloud service or team-managed repositories and configuration automation |
| Client only | Install psql/libpq client packages without running a local server |
Installed does not mean internet-ready
Do not expose port 5432 publicly or turn pg_hba.conf into a global trust rule merely to connect. Verify locally first, then design networking, TLS, authentication, and least privilege.
Run the same verification everywhere
psql --version
psql -X "postgresql://postgres@localhost:5432/postgres" \
-c "select current_setting('server_version'), current_database(), current_user;"Client and server versions are separate. psql --version reports only the client; the SQL query reports the server you actually reached. When versions coexist, record executable path, port, and data directory.
Next, read psql connections and SSL, then create an application role that is not a superuser.
Last updated on