Before you begin
Install AlloyDB Omni on your system.
Add PostGIS to your AlloyDB Omni installation
To add the PostGIS extension to your AlloyDB Omni installation, follow these steps:
- Request access to the Preview release by submitting this form.
Initialize Red Hat Subscription Manager on the VM where you installed the AlloyDB Omni server:
sudo dnf install -y subscription-manager sudo subscription-manager register --username "RHSM_USER" --password "RHSM_PASS" --auto-attach --forceReplace the following:
RHSM_USER: the Red Hat Subscription Manager user.RHSM_PASS: the Red Hat Subscription Manager password.
Enable CodeReady Builder repository:
sudo subscription-manager repos --enable="codeready-builder-for-rhel-9-$ARCH-rpms"Replace
ARCHwith the RHEL architecture you want to use, for example,x86_64.Add the PostgreSQL Yum Repository:
sudo dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-9-x86_64/pgdg-redhat-repo-latest.noarch.rpmInstall PostgreSQL server and development packages:
sudo dnf install -y "postgresql17-server"Replace
OMNI_VERSIONwith the AlloyDB Omni version number, which is17.Install the PostGIS extension:
sudo dnf install -y postgis35_17Create required symlinks so the extensions are in the expected paths:
set -e PGVER="17" sudo mkdir -p "/usr/lib/postgresql/${PGVER}/share/extension" for file in /usr/pgsql-${PGVER}/share/extension/*; do target="/usr/lib/postgresql/${PGVER}/share/extension/$(basename "$file")" if [[ ! -e "$target" ]]; then sudo ln -s "$file" "$target" || (echo "Failed to link \"$file\" to \"$target\", exiting." && exit 1) echo "Created extension link for $(basename "$file")" else echo "Target $target already exists." fi done sudo mkdir -p "/usr/lib/postgresql/${PGVER}/lib" for file in /usr/pgsql-${PGVER}/lib/*; do target="/usr/lib/postgresql/${PGVER}/lib/$(basename "$file")" if [[ ! -e "$target" ]]; then sudo ln -s "$file" "$target" || (echo "Failed to link \"$file\" to \"$target\", exiting." && exit 1) echo "Created lib link for $(basename "$file")" else echo "Target $target already exists." fi fi doneConnect to your database with the PostGIS extension:
/usr/lib/postgresql/17/bin/psql -h localhost -U postgresEnable PostGIS:
CREATE EXTENSION IF NOT EXISTS POSTGIS;Confirm that PostGIS is installed and enabled:
SELECT postgis_full_version();The output is similar to the following:
postgres=# SELECT postgis_full_version(); postgis_full_version -------------------------------------------------------------------------------------------------------------------------------- POSTGIS="3.3.2 4975da8" [EXTENSION] PGSQL="150" GEOS="3.11.1-CAPI-1.17.1" PROJ="9.1.1" LIBXML="2.9.14" LIBJSON="0.16" LIBPROTOBUF="1.4.1" WAGYU="0.5.0 (Internal)" (1 row)