[[["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.12.0keyboard_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.12.0/docs/install) on your system.\n\nAdd PostGIS to your AlloyDB Omni installation\n---------------------------------------------\n\nTo add the PostGIS extension to your AlloyDB Omni installation,\nfollow these steps:\n\n\u003cbr /\u003e\n\n1. Find your installed AlloyDB Omni version labels:\n\n ### Docker\n\n ```docker\n docker run --rm -it google/alloydbomni cat VERSION.txt\n ```\n\n ### Podman\n\n ```text\n podman 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.12.0\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.12.0`.\n3. Create a new AlloyDB Omni container that includes PostGIS: \n\n ### Linux\n\n mkdir ~/alloydb-omni-postgis\n tee -a ~/alloydb-omni-postgis/Dockerfile \u003c\u003c EOF\n ARG OMNI_VERSION\n FROM google/alloydbomni:${OMNI_VERSION}\n RUN apt-get update && \n\n apt-get install -y --no-install-recommends \n\n postgresql-15-postgis-3 && \n\n apt-get purge -y --auto-remove && \n\n rm -rf /var/lib/apt/lists/*\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 ### macOS\n\n mkdir ~/alloydb-omni-postgis\n tee -a ~/alloydb-omni-postgis/Dockerfile \u003c\u003c EOF\n ARG OMNI_VERSION\n FROM google/alloydbomni:${OMNI_VERSION}\n RUN apt-get update && \n\n apt-get install -y --no-install-recommends \n\n postgresql-15-postgis-3 && \n\n apt-get purge -y --auto-remove && \n\n rm -rf /var/lib/apt/lists/*\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\n4. Create a new container with AlloyDB Omni named `my-omni-postgis`:\n\n ### Docker\n\n ```bash\n docker run --name my-omni-postgis -e POSTGRES_PASSWORD=NEW_PASSWORD -d google/alloydbomni-with-postgis:OMNI_VERSION\n ```\n\n ### Podman\n\n ```\n podman 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 CREATE EXTENSION IF NOT EXISTS POSTGIS;\n SELECT postgis_full_version();\n\n The output looks similar to the following: \n\n postgres=# SELECT postgis_full_version();\n postgis_full_version\n --------------------------------------------------------------------------------------------------------------------------------\n 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)\"\n (1 row)\n\n\u003cbr /\u003e"]]