Skip to content

Quick Start: PostgreSQL

dbdeployer supports PostgreSQL sandboxes using the same workflow as MySQL. Because there is no official PostgreSQL tarball distribution, you extract binaries from .deb packages.

  • dbdeployer installed (Installation guide)
  • dpkg-deb available (standard on Debian/Ubuntu)
  • apt-get or apt for downloading packages (no root needed for apt-get download)
Terminal window
apt-get download postgresql-16 postgresql-client-16

This downloads two .deb files into your current directory — no installation occurs.

2. Unpack into dbdeployer’s binary directory

Section titled “2. Unpack into dbdeployer’s binary directory”
Terminal window
dbdeployer unpack --provider=postgresql \
postgresql-16_*.deb \
postgresql-client-16_*.deb

Expected output:

Unpacking postgresql-16 into $HOME/opt/postgresql/16.13
Terminal window
dbdeployer deploy postgresql 16.13

Or equivalently:

Terminal window
dbdeployer deploy single 16.13 --provider=postgresql

Expected output:

Database installed in $HOME/sandboxes/pg_sandbox_16613
Terminal window
~/sandboxes/pg_sandbox_16613/use

You are now in the psql shell:

SELECT version();
\l
\q
Terminal window
dbdeployer delete pg_sandbox_16613

You might wonder why we download debs instead of installing PostgreSQL normally. Three reasons:

  1. No root neededapt-get download works without sudo
  2. No conflict with existing PostgreSQL — if you already have PostgreSQL running, installing another version could disrupt it
  3. Multiple versions — you can have 14, 15, 16, and 17 side by side in ~/opt/postgresql/