[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-25 UTC."],[],[],null,["# Install PostGIS for AlloyDB Omni\n\nSelect a documentation version: 15.5.4keyboard_arrow_down\n\n- [Current (16.8.0)](/alloydb/omni/current/docs/install-postgis)\n- [16.8.0](/alloydb/omni/16.8.0/docs/install-postgis)\n- [16.3.0](/alloydb/omni/16.3.0/docs/install-postgis)\n- [15.12.0](/alloydb/omni/15.12.0/docs/install-postgis)\n- [15.7.1](/alloydb/omni/15.7.1/docs/install-postgis)\n- [15.7.0](/alloydb/omni/15.7.0/docs/install-postgis)\n- [15.5.5](/alloydb/omni/15.5.5/docs/install-postgis)\n- [15.5.4](/alloydb/omni/15.5.4/docs/install-postgis)\n- [15.5.2](/alloydb/omni/15.5.2/docs/install-postgis)\n\n\u003cbr /\u003e\n\nAlloyDB Omni does not include [the PostGIS\nextension](http://www.postgis.net/), but you can manually add it to an existing AlloyDB Omni installation by following the instructions on this page to add support for storing, indexing, and querying geospatial data.\n\n\u003cbr /\u003e\n\nBefore you begin\n----------------\n\nEnsure that you've [installed AlloyDB Omni](/alloydb/omni/15.5.4/docs/install) on your system. \n\n### Single-server\n\nAdd PostGIS to your AlloyDB Omni installation\n---------------------------------------------\n\nTo add the PostGIS extension to your AlloyDB Omni installation,\nfollow these steps:\n\n1. Find your installed AlloyDB Omni version labels: \n\n ```text\n docker run --rm -it google/alloydbomni cat VERSION.txt\n ```\n\n The output is similar to the following: \n\n ```\n AlloyDB Omni version: 15.5.3\n ```\n\n Take note of the AlloyDB Omni version number; you need it in the next step.\n2. Set the `OMNI_VERSION` environment variable: \n\n ```bash\n OMNI_VERSION=VERSION\n ```\n\n Replace \u003cvar translate=\"no\"\u003eVERSION\u003c/var\u003e with the complete database server version from the previous step---for example, `15.5.3`.\n3. Create a new AlloyDB Omni container that includes PostGIS:\n\n ### Linux\n\n\n mkdir ~/alloydb-omni-postgis\n tee -a ~/alloydb-omni-postgis/Dockerfile \u003c\u003c EOF\n ARG OMNI_VERSION\n FROM postgres:15-bookworm AS postgres\n\n RUN apt-get update && \\\n apt-get install -y --no-install-recommends \\\n postgresql-15-postgis-3 && \\\n apt-get purge -y --auto-remove && \\\n rm -rf /var/lib/apt/lists/*\n\n FROM google/alloydbomni:${OMNI_VERSION}\n\n COPY --from=postgres /usr/lib/postgresql/15/lib/postgis-3.so /usr/lib/postgresql/15/lib/postgis-3.so\n COPY --from=postgres /usr/lib/postgresql/15/lib/postgis_sfcgal-3.so /usr/lib/postgresql/15/lib/postgis_sfcgal-3.so\n COPY --from=postgres /usr/lib/postgresql/15/lib/postgis_raster-3.so /usr/lib/postgresql/15/lib/postgis_raster-3.so\n COPY --from=postgres /usr/lib/postgresql/15/lib/postgis_topology-3.so /usr/lib/postgresql/15/lib/postgis_topology-3.so\n COPY --from=postgres /usr/lib/postgresql/15/lib/address_standardizer-3.so /usr/lib/postgresql/15/lib/address_standardizer-3.so\n COPY --from=postgres /usr/share/postgresql/15/extension/address_standardizer* /usr/lib/postgresql/15/share/extension/\n COPY --from=postgres /usr/share/postgresql/15/extension/postgis* /usr/lib/postgresql/15/share/extension/\n\n COPY --from=postgres /usr/lib/x86_64-linux-gnu/ /usr/lib/x86_64-linux-gnu/\n COPY --from=postgres /lib/x86_64-linux-gnu/ /lib/x86_64-linux-gnu/\n\n COPY --from=postgres /usr/lib/x86_64-linux-gnu/liblapack.so.3 /usr/lib/\n COPY --from=postgres /usr/lib/x86_64-linux-gnu/libblas.so.3 /usr/lib/\n COPY --from=postgres /usr/lib/libarmadillo.so.11 /usr/lib/\n COPY --from=postgres /usr/lib/libmfhdfalt.so.0 /usr/lib/\n COPY --from=postgres /usr/lib/libmfhdfalt.so.0 /usr/lib/\n COPY --from=postgres /usr/lib/libdfalt.so.0 /usr/lib/\n COPY --from=postgres /usr/lib/libogdi.so.4.1 /usr/lib/\n COPY --from=postgres /usr/share/proj/proj.db /usr/share/proj/proj.db\n\n EOF\n cd ~/alloydb-omni-postgis\n sudo docker build --build-arg OMNI_VERSION=$OMNI_VERSION --tag google/alloydbomni-with-postgis:$OMNI_VERSION .\n \n \u003cbr /\u003e\n\n ### macOS\n\n\n mkdir ~/alloydb-omni-postgis\n tee -a ~/alloydb-omni-postgis/Dockerfile \u003c\u003c EOF\n ARG OMNI_VERSION\n FROM postgres:15-bookworm AS postgres\n\n RUN apt-get update && \\\n apt-get install -y --no-install-recommends \\\n postgresql-15-postgis-3 && \\\n apt-get purge -y --auto-remove && \\\n rm -rf /var/lib/apt/lists/*\n\n FROM google/alloydbomni:${OMNI_VERSION}\n\n COPY --from=postgres /usr/lib/postgresql/15/lib/postgis-3.so /usr/lib/postgresql/15/lib/postgis-3.so\n COPY --from=postgres /usr/lib/postgresql/15/lib/postgis_sfcgal-3.so /usr/lib/postgresql/15/lib/postgis_sfcgal-3.so\n COPY --from=postgres /usr/lib/postgresql/15/lib/postgis_raster-3.so /usr/lib/postgresql/15/lib/postgis_raster-3.so\n COPY --from=postgres /usr/lib/postgresql/15/lib/postgis_topology-3.so /usr/lib/postgresql/15/lib/postgis_topology-3.so\n COPY --from=postgres /usr/lib/postgresql/15/lib/address_standardizer-3.so /usr/lib/postgresql/15/lib/address_standardizer-3.so\n COPY --from=postgres /usr/share/postgresql/15/extension/address_standardizer* /usr/lib/postgresql/15/share/extension/\n COPY --from=postgres /usr/share/postgresql/15/extension/postgis* /usr/lib/postgresql/15/share/extension/\n\n COPY --from=postgres /usr/lib/aarch64-linux-gnu/ /usr/lib/aarch64-linux-gnu/\n COPY --from=postgres /lib/aarch64-linux-gnu/ /lib/aarch64-linux-gnu/\n\n COPY --from=postgres /usr/lib/aarch64-linux-gnu/liblapack.so.3 /usr/lib/\n COPY --from=postgres /usr/lib/aarch64-linux-gnu/libblas.so.3 /usr/lib/\n COPY --from=postgres /usr/lib/libarmadillo.so.11 /usr/lib/\n COPY --from=postgres /usr/lib/libmfhdfalt.so.0 /usr/lib/\n COPY --from=postgres /usr/lib/libmfhdfalt.so.0 /usr/lib/\n COPY --from=postgres /usr/lib/libdfalt.so.0 /usr/lib/\n COPY --from=postgres /usr/lib/libogdi.so.4.1 /usr/lib/\n COPY --from=postgres /usr/share/proj/proj.db /usr/share/proj/proj.db\n\n EOF\n cd ~/alloydb-omni-postgis\n sudo docker build --build-arg OMNI_VERSION=$OMNI_VERSION --tag google/alloydbomni-with-postgis:$OMNI_VERSION .\n\n \u003cbr /\u003e\n\n4. Create a new container with AlloyDB Omni named `my-omni-postgis`: \n\n ```\n docker run --name my-omni-postgis -e POSTGRES_PASSWORD=NEW_PASSWORD -d google/alloydbomni-with-postgis:OMNI_VERSION\n ```\n5. Connect to your database with the PostGIS extension: \n\n ```\n docker exec -it my-omni-postgis psql -h localhost -U postgres\n ```\n6. Enable PostGIS: \n\n ```sql\n CREATE EXTENSION IF NOT EXISTS POSTGIS;\n\n SELECT postgis_full_version();\n ```\n The output looks similar to the following: \n\n ```sql\n postgis_full_version\n ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n POSTGIS=\"3.4.2 c19ce56\" [EXTENSION] PGSQL=\"150\" GEOS=\"3.11.1-CAPI-1.17.1\" PROJ=\"9.1.1 NETWORK_ENABLED=OFF URL_ENDPOINT= USER_WRITABLE_DIRECTORY=/var/lib/postgresql/.local/share/proj DATABASE_PATH=/usr/share/proj/proj.db\" LIBXML=\"2.9.14\" LIBJSON=\"0.16\" LIBPROTOBUF=\"1.4.1\" WAGYU=\"0.5.0 (Internal)\"\n (1 row)\n ```"]]