Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # CURRENT PRODUCTION - February 2014
- export POSTGRES=postgresql-9.3.4
- export POSTGIS=postgis-2.1.2
- export PROJ=proj-4.8.0
- export PROJ_DATUM=proj-datumgrid-1.5
- export GEOS=geos-3.4.2
- export GDAL=gdal-1.10.1
- # LAST
- #export POSTGRES=postgresql-9.0.1
- #export POSTGIS=postgis-1.5.2
- #export PROJ=proj-4.7.0
- #export GEOS=geos-3.2.2
- #export GDAL=gdal-1.8.0
- #export PROJ_DATUM=proj-datumgrid-1.5
- # ORIGINAL - VERY OLD (here just to track where we started)
- #export POSTGRES=postgresql-8.2.4
- #export POSTGIS=postgis-1.2.1
- #export PROJ=proj-4.5.0
- #export GEOS=geos-2.2.3
- #export GDAL=gdal-1.5.0
- function deleter()
- {
- cd ~
- rm -rf build/$POSTGRES install/$POSTGRES
- rm -rf build/$POSTGIS install/$POSTGIS
- rm -rf build/$PROJ install/$PROJ
- rm -rf build/$GEOS install/$GEOS
- rm -rf build/$GDAL install/$GDAL
- rm -P ~/postgres ~/install/postgres ~/install/geos ~/install/proj ~/install/gdal ~/build/postgis
- }
- function unziper()
- {
- echo ___________ START: UNTAR EVERYTHING _________________
- cd ~/build
- tar xzvf ~/archives/$POSTGRES.tar.gz
- tar xzvf ~/archives/$POSTGIS.tar.gz
- tar xzvf ~/archives/$PROJ.tar.gz
- tar xjvf ~/archives/$GEOS.tar.bz2
- tar xvf ~/archives/$GDAL.tar
- echo ___________ DONE: UNTAR EVERYTHING _________________
- }
- # builds proj & geos libs
- function proj_geos()
- {
- # step a: INSTALL datum shifting http://proj.maptools.org/faq.html
- cd ~/build/$PROJ/nad/
- unzip ~/archives/$PROJ_DATUM.zip
- tar xjvf ~/archives/$PROJ_DATUM.tar.bz2
- builder $PROJ 'proj'
- builder $GEOS 'geos'
- }
- #
- # builder function
- #
- function builder()
- {
- target=$1
- idir=$2
- echo ___________ START: BUILD $target _________________
- cd ~/build/
- cd $target
- configure --prefix=/home/geoserve/install/$target
- make
- make install
- ln -s ~/install/$target ~/install/$idir
- echo ___________ END: BUILD $target _________________
- echo
- }
- function postgis()
- {
- echo ___________ START: BUILD POSTGIS _________________
- cd ~/build/$POSTGIS
- configure --with-projdir=/home/geoserve/install/proj --prefix=/home/geoserve/install/$POSTGIS
- make
- make install
- ln -s ~/build/$POSTGIS ~/install/postgis
- echo ___________ START: BUILD POSTGIS _________________
- echo
- }
- deleter;
- unziper;
- proj_geos;
- builder $GDAL 'gdal'
- builder $POSTGRES 'postgres'
- ln -s ~/install/$POSTGRES ~/postgres
- postgis;
- function init_postgis_old()
- {
- echo ___________ ENABLE POSTGIS _________________
- cd ~/postgres
- psql -p $PGPORT -d trimet -f share/contrib/postgis-2.1/postgis.sql
- psql -p $PGPORT -d trimet -f share/contrib/postgis-2.1/spatial_ref_sys.sql
- # NOTE: if lwpostgis.sql fails to load, try the following
- # cd ~/postgres/lib
- # ln -s ~/install/geos/lib/* .
- # cd -
- }
- #
- # create a new PG database
- #
- function init_postres()
- {
- echo
- echo ___________ INIT POSTGRES _________________
- # initdb on new postgres
- cd ~
- mkdir postgres/log
- initdb -D ~/postgres/data
- # 'fix' postgres
- sleep 3
- cd ~/postgres/data
- mkdir old
- mv pg_hba.conf postgresql.conf old/
- ln -s ~/MapConfig/postgres/*conf .
- echo
- echo ___________ START POSTGRES _________________
- # start postgres / create trimet db
- pg_ctl -D ~/postgres/data -l ~/postgres/log/logfile.txt -m fast start
- sleep 3
- ps -ef | grep post
- createdb -p $PGPORT trimet
- createlang -p $PGPORT plpgsql trimet
- }
- #
- # spatially enable the trimet db with PostGIS
- #
- function init_postgis()
- {
- psql -p $PGPORT -d trimet -c "CREATE EXTENSION postgis;"
- }
- init_postres;
- init_postgis;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement