-
Notifications
You must be signed in to change notification settings - Fork 41
Expand file tree
/
Copy pathbuild_postgis.sh
More file actions
34 lines (29 loc) · 1.13 KB
/
build_postgis.sh
File metadata and controls
34 lines (29 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash
################################################################################
#
# This script downloads PostGIS from the official web site into ./workdir
# then builds it.
#
# Usage: ./build_postgis.sh pg_version postgis_version
# pg_version is a PostgreSQL version to be installed like 16.0.
# postgis_version is a PostGIS version to be installed.
#
# Requirements
# - be able to connect to the PostGIS official web site by wget.
#
################################################################################
POSTGRESQL_VERSION=$1
POSTGIS_VERSION=$2
# Install necessary dependencies
sudo apt update
sudo apt install -y build-essential libxml2-dev libgeos-dev libproj-dev libgdal-dev libjson-c-dev libprotobuf-c-dev protobuf-c-compiler
cd ./workdir
# Download and compile PostGIS
cp -vr postgis postgresql-${POSTGRESQL_VERSION}/contrib
cd postgresql-${POSTGRESQL_VERSION}/contrib/postgis
echo " - PostGIS directory"
GEOS_CONFIG_PATH=$(which geos-config)
export LD_LIBRARY_PATH=/usr/local/lib/:$LD_LIBRARY_PATH
./configure --with-pgconfig=/usr/local/pgsql/bin/pg_config --with-geosconfig=$GEOS_CONFIG_PATH
make
sudo make install