Skip to content

Latest commit

 

History

History
408 lines (276 loc) · 24.5 KB

prebuilt-packages.md

File metadata and controls

408 lines (276 loc) · 24.5 KB
title Pre-built Packages
description Install the complete DocumentDB stack with a setup wizard, or choose individual PostgreSQL and gateway packages. Includes PGDG and source-build options.

Pre-built Packages

Install a complete MongoDB-compatible service, or add only the components you need to a PostgreSQL instance you manage. Since v0.116, DocumentDB's packages include a setup wizard, administrator tools, and systemd integration.

Get first-party packages from documentdb.io, extension packages from PGDG, or build packages for another target with the provided scripts.

Choose an installation path

You want Installation
A working DocumentDB instance with minimal setup Stand-alone stack, recommended: install documentdb and run the wizard.
MongoDB-compatible access to a PostgreSQL instance you manage Extension + gateway: configure the components separately and retain your PostgreSQL service lifecycle.
DocumentDB through SQL, without a gateway Extension only: install the extension and optional administrator tools.

First-party packages

The current release is v1.2-0. See the 1.2 release notes for what changed. First-party CI builds and tests the full stack for:

Distribution PostgreSQL Architectures
Ubuntu 24.04 (DEB) 17, 18 amd64, arm64
RHEL-compatible 9 (RPM) 17, 18 x86_64, aarch64

Ubuntu 24.04 with PostgreSQL 18 is the recommended default. Other targets may be available through PGDG or the build scripts; they are not part of this hosted matrix.

For a clean host, the installer configures repositories, installs packages, and runs setup:

curl -fsSLo documentdb-install.sh https://documentdb.io/install.sh &&
sudo sh documentdb-install.sh

This installs the current release on PostgreSQL 18. Use --pg-major 17 for PostgreSQL 17. Run it with sudo: started as a normal user, it calls sudo -v, which asks for a password even on cloud images whose default user has passwordless sudo.

To choose a release:

Command Installs Later apt upgrade / dnf upgrade
sudo sh documentdb-install.sh The newest release, from the latest package channel Follows each new release
sudo sh documentdb-install.sh --stable The stable channel, which can stay on the previous release for a while after a new one Follows stable
sudo sh documentdb-install.sh --version 1.0.0 Exactly that release (1.0.0 or later), from its GitHub release files None: no DocumentDB repository is configured

It asks you to confirm the plan and to choose the admin password. For an unattended run, store the password in a root-owned file and pass --yes:

printf 'DocumentDB admin password: '; IFS= read -r -s PW; echo
printf '%s\n' "$PW" | sudo install -m 600 /dev/stdin /root/documentdb-admin.pw
sudo sh documentdb-install.sh --yes \
  --admin-password-file /root/documentdb-admin.pw --accept-external-listen

--accept-external-listen acknowledges that the gateway listens on all interfaces. The manual steps below install the same release. To move an existing installation to 1.2, see Upgrading to 1.2 instead.

Set up and connect

These steps are for a new stand-alone installation. For an existing deployment, read Upgrading to 1.2 first.

1. Install the stack

Use the Package Finder or Linux Packages Quick Start to configure the repositories for your distribution and architecture. First-party packages depend on PostgreSQL and extensions from PGDG; EL9 also needs EPEL and CRB / CodeReady Builder.

With the repositories configured, install the stack on Ubuntu:

sudo apt install documentdb

On EL9, use sudo dnf install documentdb. Both documentdb (the PG18 default) and documentdb-18 (used by the Package Finder) install the complete stack.

2. Run the setup wizard

The gateway listens on all interfaces by default. Restrict access to port 10260 before setup on a network-accessible host; use a trusted certificate before allowing remote clients.

sudo documentdb-setup --pg-version 18 --use-new-postgres-instance --admin-user admin

The wizard prompts for the admin password, creates a private PostgreSQL 18 instance, configures extensions and the admin user, and starts the gateway. On systemd hosts it also enables the stack at boot.

3. Connect

Install mongosh separately, then connect interactively:

mongosh localhost:10260 --authenticationMechanism SCRAM-SHA-256 \
  --tls --tlsAllowInvalidCertificates -u admin -p

Enter the password set in the wizard, then run:

db.runCommand({ ping: 1 })

The local example accepts the generated self-signed certificate. A bare -p prompts for a password; non-interactive scripts must supply a password explicitly. db.version() reports the MongoDB version DocumentDB is compatible with, not the DocumentDB version; see Check the version.

Optional setup controls

Requirement How
Use PostgreSQL 17 Install documentdb-17 instead of documentdb, and use --pg-version 17.
Preview changes Add --dry-run before applying setup.
Change the gateway port Add --listen-port 27017, or another unused port.
Load sample data Add --load-sample-data to load StoreData; requires mongosh.
Automate setup Use --yes with --admin-password-file /path/to/protected-file (mode 0600) or --admin-password-stdin.
Adopt an existing local PostgreSQL instance Replace --use-new-postgres-instance with --target-postgres-instance 18/main; review the proposed changes and plan PostgreSQL restarts.

Inspect state with sudo documentdb-setup --pg-version 18 --status. On systemd, restart this stack with sudo systemctl restart documentdb-local@18.target; adopted PostgreSQL retains its own lifecycle. See Operating a package install for TLS and other operational guidance.

Remove the stack

Delete the instance first, then the packages. documentdb-local-reset ships in documentdb-common, so it has to run before the purge; purging alone keeps the data directory.

sudo documentdb-local-reset --pg-version 18 --confirm-destroy
sudo apt purge -y '*documentdb*'      # Ubuntu
sudo dnf remove -y '*documentdb*'     # EL9

The reset is irreversible and only covers the stand-alone stack's private instance, not an adopted PostgreSQL. Open remove and purge problems are tracked in #771.

What each release publishes

N is the PostgreSQL major version. The package manager installs the dependencies of your selected package.

Package Purpose
documentdb Convenience meta package selecting documentdb-18; also provides the documentdb-local.target alias.
documentdb-N Complete stand-alone stack for major N; owns its systemd lifecycle.
postgresql-N-documentdb (DEB) / postgresqlN-documentdb (RPM) Extension libraries and SQL files only; does not configure existing PostgreSQL instances.
documentdb-postgresql-tools documentdb-tune, documentdb-createcluster, documentdb-register-gateway, and documentdb-gateway-admin.
documentdb-gateway MongoDB wire-protocol runtime and its service; does not configure PostgreSQL.
documentdb-common Shared wizard, service templates, helpers, and sample data, pulled in by documentdb-N.

Extension-only installation

This alternative uses first-party packages on Ubuntu 24.04 with an administrator-managed PostgreSQL 18 cluster named main. Install only the extension and tools, not documentdb or documentdb-N:

sudo apt install postgresql-18-documentdb documentdb-postgresql-tools
sudo documentdb-tune --pg-version 18 --cluster main --dry-run

Review the proposed configuration, then apply it during a suitable restart window:

sudo documentdb-tune --pg-version 18 --cluster main --yes &&
sudo systemctl restart postgresql@18-main &&
sudo -u postgres /usr/bin/psql --cluster 18/main -d postgres -v ON_ERROR_STOP=1 \
  -c "CREATE EXTENSION IF NOT EXISTS documentdb CASCADE;" \
  -c "CREATE EXTENSION IF NOT EXISTS documentdb_extended_rum CASCADE;"

Both extension statements are required after the restart; CASCADE does not create documentdb_extended_rum. Adjust the major and cluster name for your instance. For other layouts, follow the restart and connection commands printed by documentdb-tune.

For a new Debian/Ubuntu cluster, sudo documentdb-createcluster 18 docdb --start combines cluster creation, tuning, startup, and extension creation. Choose a cluster name that does not already exist.

Add a gateway

After the extension-only steps, install and register a gateway. Store the admin password in a protected file (mode 0600) and substitute its path below:

sudo apt install documentdb-gateway
sudo documentdb-register-gateway --target-postgres-instance 18/main \
  --admin-user admin --admin-password-file /path/to/admin-password --yes
sudo systemctl reload postgresql@18-main
sudo systemctl enable --now documentdb-gateway

Registration configures authentication and the admin user. Connect with mongosh as above. This path uses documentdb-gateway.service, not the stand-alone target, and requires PostgreSQL on the same host; remote TCP/password backends are not supported by package-managed registration.

PGDG extension packages

DocumentDB is also included in the PostgreSQL Global Development Group (PGDG) APT repository, with packaging maintained by the Debian PostgreSQL team. This is an extension-only distribution: it does not include the first-party gateway, setup wizard, or administrator tools.

As of 2026-11-15, PGDG publishes DocumentDB 1.2 (extension 1.2-0, package version 1.2-0-1.pgdg…) for PostgreSQL 15-18 on Debian 13 (trixie-pgdg), Debian 14 (forky-pgdg, testing) and Ubuntu 26.04 (resolute-pgdg), including amd64 and arm64, and on Ubuntu 26.10 (stonking-pgdg) for amd64 only. PGDG builds can lag first-party releases, and its targets differ from the first-party matrix; check the PGDG package pool for what it publishes now.

For a new installation, follow the PGDG repository setup instructions for Debian or Ubuntu, then inspect the candidate for your chosen PostgreSQL major version:

sudo apt update
apt-cache policy postgresql-18-documentdb

If the candidate is 1.2-0-1.pgdg… or later, install it:

sudo apt install postgresql-18-documentdb

Configure PostgreSQL and create the extensions for that packaged version separately; the first-party helper commands above do not apply. Do not use another distribution's repository to obtain a missing package, or treat a provider switch as an in-place upgrade.

An earlier PGDG installation upgrades in place; the 1.2 package carries the upgrade scripts for every version PGDG has published, 0.108 on. Back up first; there is no downgrade. Stop applications and any gateway you run, and keep them stopped until the extensions are updated. The commands below use PostgreSQL 18, cluster main and database postgres: substitute yours throughout, and update every database where you created the extensions.

Upgrade the package and check where shared_preload_libraries is set:

sudo apt update && sudo apt install --only-upgrade postgresql-18-documentdb
sudo -u postgres psql --cluster 18/main -d postgres -Atc \
  "SELECT setting, sourcefile FROM pg_settings WHERE name = 'shared_preload_libraries';"

If pg_documentdb_extended_rum isn't listed (it may be missing on 0.116 and older), add it next to the existing pg_cron, pg_documentdb_core, pg_documentdb in the file shown, usually /etc/postgresql/18/main/postgresql.conf; a value set with ALTER SYSTEM lives in postgresql.auto.conf and overrides it. DocumentDB loads the library only from there, and when documentdb_extended_rum already exists the extension update succeeds without it while index builds fail later. Then restart PostgreSQL either way, so it loads the new libraries, and confirm all four are listed:

sudo systemctl restart postgresql@18-main &&
sudo -u postgres psql --cluster 18/main -d postgres -Atc "SHOW shared_preload_libraries;"

Then update the extensions, and check the package, extension and library versions; PGDG has no gateway for the mongosh check below:

sudo -u postgres psql --cluster 18/main -d postgres -1 -v ON_ERROR_STOP=1 \
  -c "ALTER EXTENSION documentdb_core UPDATE;" \
  -c "ALTER EXTENSION documentdb UPDATE;" \
  -c "CREATE EXTENSION IF NOT EXISTS documentdb_extended_rum CASCADE;" \
  -c "ALTER EXTENSION documentdb_extended_rum UPDATE;"
dpkg-query -W -f='${Version}\n' postgresql-18-documentdb
sudo -u postgres psql --cluster 18/main -d postgres -At \
  -c "SELECT extname, extversion FROM pg_extension WHERE extname LIKE 'documentdb%';" \
  -c "SELECT documentdb_api.binary_version();"

Expect package 1.2-0-1.pgdg…, 1.2-0 for every extension and library 1.2.0.

A host on PGDG's 1.0~RC1 is offered 1.2-0 by apt upgrade, but upgrading a release candidate isn't supported. Check dpkg-query before upgrading: RC1 already reports extension 1.0-0 and library 1.0.0, so only the package version tells it apart from 1.0, and newer libraries don't repair data the RC wrote. Move the data to a fresh 1.2 instance instead. mongodump and mongorestore need a MongoDB-compatible gateway in front of both instances, which PGDG doesn't ship.

Community builds

No package for your target? The supplied scripts build DEB or RPM packages with Docker; select the distribution and PostgreSQL major version rather than writing packaging files yourself.

Use a Linux build environment with Git, Docker, Bash 4+, and GNU utilities, on the target architecture. For example, build the extension for Debian 12 and PostgreSQL 18:

git clone --depth 1 --branch v1.2-0 https://github.com/documentdb/documentdb.git
cd documentdb
./packaging/build_packages.sh --os deb12 --pg 18 --version 1.2.0 --output-dir packages

Pass --version 1.2.0 explicitly, so the packages carry the release version.

For the full stand-alone DEB set, make dpkg-deb available on the build host, then build the gateway and shared packages:

./packaging/gateway/build_gateway_packages.sh --os deb12 --pg 18 \
  --version 1.2.0 --output-dir packages
./packaging/build_extra_packages.sh --type deb --pg 18 \
  --version 1.2.0 --output-dir packages

Outputs go into packages/. RPM extras instead require host rpmbuild and applicable RPM macros. The versioned packaging guide lists targets, prerequisites, and clean-install checks.

Validate builds for targets outside the first-party CI matrix in your environment. PostgreSQL 15 is extension-only; package-managed gateway setup requires PostgreSQL 16 or newer.

Download and verify

Use release assets when you need an exact first-party version rather than a repository install. Each release publishes its Linux packages with SHA256SUMS and manifest.txt.

gh release download v1.2-0 -R documentdb/documentdb -D pkgs && cd pkgs && sha256sum -c SHA256SUMS

This downloads all formats, architectures, and PostgreSQL major versions. Install only the matching subset below, not every downloaded file.

Install from downloaded assets

Enable the dependency repositories first: PGDG, plus EPEL and CRB / CodeReady Builder on EL9. Pass the matching local files to one apt or dnf command so dependencies resolve in the same transaction.

These examples install documentdb-18 and its dependencies; the optional documentdb meta package is not needed.

DEB (Ubuntu 24.04, PostgreSQL 18, amd64)

For arm64, replace amd64 with arm64. Only the gateway and extension files are architecture-specific.

sudo apt install ./ubuntu24.04-documentdb-18_1.2.0_all.deb \
                 ./ubuntu24.04-documentdb-common_1.2.0_all.deb \
                 ./ubuntu24.04-documentdb-postgresql-tools_1.2.0_all.deb \
                 ./ubuntu24.04-documentdb-gateway_1.2.0_amd64.deb \
                 ./ubuntu24.04-postgresql-18-documentdb_1.2-0_amd64.deb

RPM (RHEL-compatible 9, PostgreSQL 18, x86_64)

For arm64, replace x86_64 with aarch64; leave noarch files unchanged.

sudo dnf install ./documentdb-18-1.2.0-1.noarch.rpm \
                 ./documentdb-common-1.2.0-1.noarch.rpm \
                 ./documentdb-postgresql-tools-1.2.0-1.noarch.rpm \
                 ./documentdb-gateway-1.2.0-1.el9.x86_64.rpm \
                 ./rhel9-postgresql18-documentdb-1.2.0-1.el9.x86_64.rpm

For PostgreSQL 17, replace the two PostgreSQL-specific files with their 17 equivalents; the shared packages stay the same. The documentdb meta package always selects PG18.

For extension-only use, install the extension and tools files, then configure PostgreSQL. For a full stack, run the wizard with the installed major: use --pg-version 17 for PG17.

Filename prefixes such as ubuntu24.04- and rhel9- identify release assets, not package names. DEB extensions use version 1.2-0, while other packages use 1.2.0; RPMs use 1.2.0 with release 1 or 1.el9.

Offline / air-gapped

Release assets do not include the full dependency set. Stage PostgreSQL, its required extensions, and all other dependencies on a connected machine of the same distro, release, and architecture. Include dependencies already installed on the staging machine. Follow Offline / air-gapped install to serve the bundle as a local repository.

Upgrading to 1.2

A 1.0 package installation can be upgraded in place; upgrade all DocumentDB packages together. A release ships new libraries and a new extension catalog version. PostgreSQL loads the new libraries only when it restarts, and the catalog in each database changes only with ALTER EXTENSION ... UPDATE; until both have happened, some commands fail with InternalError. Back up first; there is no downgrade.

Upgrading a host that ever ran a release candidate isn't supported, and the installer refuses it. Install 1.2 on a fresh host and move the data with mongodump and mongorestore. Removing packages keeps the PostgreSQL data; don't reset or reuse an adopted instance as an upgrade workaround.

Stand-alone stack

A host set up by the 1.0 installer, or with --stable, follows the stable package channel, which still serves 1.0. To upgrade it now, point it at the latest channel first:

# Debian / Ubuntu
sudo sed -i 's# stable ubuntu24$# latest ubuntu24#' /etc/apt/sources.list.d/documentdb.list

# RHEL-compatible 9
sudo sed -i 's#^baseurl=https://documentdb.io/rpm/rhel9$#baseurl=https://documentdb.io/rpm/latest/rhel9#' /etc/yum.repos.d/documentdb.repo

Then upgrade the packages and finish the upgrade with the setup wizard, naming the PostgreSQL major of the install, plus any --data-dir or --pg-port it was set up with:

# Debian / Ubuntu
sudo apt update && sudo apt install --only-upgrade documentdb-18 postgresql-18-documentdb \
  documentdb-common documentdb-gateway documentdb-postgresql-tools &&
sudo documentdb-setup --pg-version 18 --yes

# RHEL-compatible 9
sudo dnf upgrade documentdb-18 postgresql18-documentdb \
  documentdb-common documentdb-gateway documentdb-postgresql-tools &&
sudo documentdb-setup --pg-version 18 --yes

The packages restart the gateway but not PostgreSQL. The wizard restarts documentdb-postgresql@18 once to load the new libraries, then updates documentdb_core, documentdb and documentdb_extended_rum. It keeps the gateway port and TLS settings. Without --admin-user it needs no password and leaves every admin user and password as it is; with --admin-user it resets that user's password, as on any re-run. For PostgreSQL 17, use 17 throughout.

These commands assume the DocumentDB package repository. If you installed from release assets, download the 1.2 assets and install the same set of files the same way in place of the apt/dnf command. The shared packages (documentdb-common, documentdb-gateway, documentdb-postgresql-tools) serve every PostgreSQL major on the host, so if more than one major is installed, run the wizard for each of them.

Extension and gateway on your own PostgreSQL

If you adopted the instance with documentdb-setup --target-postgres-instance 18/main, upgrade the packages, then run:

sudo documentdb-setup --target-postgres-instance 18/main --yes

The wizard doesn't restart your PostgreSQL. It prints the restart command and the setup command to run next, then stops; run both. The second run updates the extensions and keeps the existing admin users.

Otherwise, stop the gateway, upgrade the packages, restart PostgreSQL so it loads the new libraries, and update the extensions in every database where you created them, in this order, because ALTER EXTENSION doesn't update dependencies. On Ubuntu with a cluster named main:

sudo systemctl stop documentdb-gateway &&
sudo apt update && sudo apt install --only-upgrade postgresql-18-documentdb \
  documentdb-postgresql-tools documentdb-gateway &&
sudo systemctl restart postgresql@18-main &&
sudo -u postgres /usr/bin/psql --cluster 18/main -d postgres -1 -v ON_ERROR_STOP=1 \
  -c "ALTER EXTENSION documentdb_core UPDATE;" \
  -c "ALTER EXTENSION documentdb UPDATE;" \
  -c "ALTER EXTENSION documentdb_extended_rum UPDATE;" &&
sudo systemctl start documentdb-gateway

Leave out the gateway commands if you installed only the extension. -1 runs the statements as one transaction, so a failure leaves every extension at its old version, and the gateway starts again only on success. Running them before PostgreSQL restarts fails with could not find function ... in file ".../pg_documentdb.so". Keep pg_documentdb_extended_rum in shared_preload_libraries: DocumentDB loads the extended RUM library only from there.

Check the version

Connect with mongosh and run:

db.hello().internal.documentdb_versions

It should print [ '1.2-0', '1.2.0' ]: the installed extension version, then the loaded library version. If the first value is still 1.0-0, the extensions weren't updated. See hello.

Containers

A newer DocumentDB Local image updates the extensions on an existing data volume when it starts. See Upgrading the image.

Retired targets

The hosted matrix excludes PostgreSQL 15/16, Debian 11/12/13, Ubuntu 22.04, and RHEL-compatible 8. Since v0.116, older packages for retired targets are not carried forward, including PG16 extensions formerly hosted for Ubuntu 24.04 and EL9. Existing installations keep running, but cannot update or reinstall those packages from documentdb.io.

For older installations, use matching GitHub release assets, including their dependencies, or consider PGDG and source builds where available. Changing provider or platform requires compatibility and recovery planning; it is not an automatic migration.

Retired URLs retain empty signed metadata so package-manager refreshes do not disrupt unrelated operations. If a host will no longer use first-party packages, remove its DocumentDB repository entry. This removes neither packages nor data; keep PGDG if other packages still use it.

# Debian / Ubuntu
sudo rm -f /etc/apt/sources.list.d/documentdb.list
sudo apt update

# RHEL-compatible
sudo rm -f /etc/yum.repos.d/documentdb.repo
sudo dnf clean all

Container image

For macOS, Windows, or a container-based installation, follow DocumentDB Local. Release 1.2 provides Linux amd64/arm64 images for PostgreSQL 15-18; use a versioned tag rather than latest when you need a reproducible version.