-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathInstall_Postgres10-In-Amazon-2.sh
More file actions
122 lines (113 loc) · 3.02 KB
/
Install_Postgres10-In-Amazon-2.sh
File metadata and controls
122 lines (113 loc) · 3.02 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#!/bin/bash
# Script to install PostgreSQL 10 and PostGIS 2.5 on fresh Amazon Linux 2
# Installing from source:
# - GEOS 3.7.1
# - GDAL 2.4.0
# - PostGIS 2.5.1
set -e
sudo amazon-linux-extras install postgresql10 vim epel -y
sudo yum-config-manager --enable epel -y
sudo yum update -y
sudo yum install -y make automake gcc gcc-c++ libcurl-devel proj-devel pcre-devel autoconf automake libxml2-devel
sudo yum install -y postgresql-server postgresql-devel
############################
# Install GEOS from Source #
############################
curl -O http://download.osgeo.org/geos/geos-3.7.1.tar.bz2
tar xvjf geos-3.7.1.tar.bz2
rm -f geos-3.7.1.tar.bz2
cd geos-3.7.1/
./configure
make
sudo make install
cd
############################
# Install GDAL from Source #
############################
curl -O http://download.osgeo.org/gdal/2.4.0/gdal-2.4.0.tar.gz
tar xvzf gdal-2.4.0.tar.gz
rm -f gdal-2.4.0.tar.gz
cd gdal-2.4.0
./configure \
--prefix=${PREFIX} \
--with-geos \
--with-geotiff=internal \
--with-hide-internal-symbols \
--with-libtiff=internal \
--with-libz=internal \
--with-threads \
--without-bsb \
--without-cfitsio \
--without-cryptopp \
--with-curl \
--without-dwgdirect \
--without-ecw \
--without-expat \
--without-fme \
--without-freexl \
--without-gif \
--without-gif \
--without-gnm \
--without-grass \
--without-grib \
--without-hdf4 \
--without-hdf5 \
--without-idb \
--without-ingres \
--without-jasper \
--without-jp2mrsid \
--without-jpeg \
--without-kakadu \
--without-libgrass \
--without-libkml \
--without-libtool \
--without-mrf \
--without-mrsid \
--without-mysql \
--without-netcdf \
--without-odbc \
--without-ogdi \
--without-openjpeg \
--without-pcidsk \
--without-pcraster \
--with-pcre \
--without-perl \
--with-pg \
--without-php \
--without-png \
--without-python \
--without-qhull \
--without-sde \
--without-sqlite3 \
--without-webp \
--with-xerces \
--with-xml2
make
sudo make install
cd
###################################
# Install PostGIS 2.5 from source #
###################################
curl -O https://download.osgeo.org/postgis/source/postgis-2.5.1.tar.gz
tar xvzf postgis-2.5.1.tar.gz
rm -f postgis-2.5.1.tar.gz
cd postgis-2.5.1/
./configure --with-address-standardizer
make
sudo make install
###################
# Final Prep Work #
###################
sudo ln -s /usr/local/lib/libgeos_c.so.1 /usr/lib64/pgsql/libgeos_c.so.1
sudo sh -c 'echo /usr/local/lib > /etc/ld.so.conf.d/postgresql.conf'
sudo sh -c 'echo /usr/lib64/pgsql >> /etc/ld.so.conf.d/postgresql.conf'
sudo ldconfig -v
export PGHOME=/var/lib/pgsql/data/
sudo su postgres -c "pg_ctl -D $PGHOME initdb"
sudo systemctl enable postgresql
sudo systemctl start postgresql
echo "
Your system is now running PostgreSQL 10, with PostGIS 2.5.
You should now run "aws configure" to set up the AWS CLI.
Afterwards, you should stop this instance and create an AMI.
"