Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Like the related PostgreSQL Install Guide, you still need to create a new Custom Application (listening on port) in the control panel called "pgport" to reserve a port. Enter it as a shell variable:
- export PGPORT=35270
- You can run these commands individually, or you can paste them into a shell script and run it as
- bash build_psql.sh | tee build_psql.log
- Either way, you may want to run it in a screen session.
- #!/bin/bash
- mkdir -p $HOME/bin $HOME/lib $HOME/src $HOME/tmp
- export TMPDIR=$HOME/tmp
- export PATH="$HOME/bin:$PATH"
- export C_INCLUDE_PATH="$HOME/include:$C_INCLUDE_PATH"
- export LIBRARY_PATH="$HOME/lib:$LIBRARY_PATH"
- export LD_LIBRARY_PATH="$HOME/lib:$LD_LIBRARY_PATH"
- ############################################################
- # CARTODB COMPLETE INSTALL - DEPENDENCIES & INSTALL PRIORITY
- ############################################################
- # PROGRAM: VERSION: NOTES:
- # ----------------------------------------------------------
- # GDAL (1.9.0) http://download.osgeo.org/gdal/gdal-1.9.0.tar.gz
- # GEOS (3.3.1) http://download.osgeo.org/geos/geos-3.3.1.tar.bz2
- # Postgres (9.1.x) http://www.postgresql.org/ftp/source/v9.1.3/
- # PostGIS (2.0) http://postgis.refractions.net/download
- ############################################################
- # GDAL (1.9.0)
- # http://download.osgeo.org/gdal/gdal-1.9.0.tar.gz
- ############################################################
- cd ~/src
- wget http://download.osgeo.org/gdal/gdal-1.9.0.tar.gz
- tar -xzf gdal-1.9.0.tar.gz
- cd gdal-1.9.0
- ./configure --prefix=$HOME
- make # 15m
- #make check
- make install
- ############################################################
- # GEOS (3.3.1)
- # http://download.osgeo.org/geos/geos-3.3.1.tar.bz2
- ############################################################
- cd ~/src
- wget http://download.osgeo.org/geos/geos-3.3.1.tar.bz2
- tar -xjf geos-3.3.1.tar.bz2
- cd geos-3.3.1
- CFLAGS="-m64 $CFLAGS" CPPFLAGS="-m64 $CPPFLAGS" CXXFLAGS="-m64 $CXXFLAGS" \
- FFLAGS="-m64 $FFLAGS" LDFLAGS="-m64 -L$HOME/lib -L/usr/lib64/ $LDFLAGS" \
- ./configure --prefix=$HOME
- make # 4m 20s
- #make check
- make install
- ############################################################
- # Postgres (9.1.3)
- # http://www.postgresql.org/ftp/source/v9.1.3/
- ############################################################
- cd ~/src
- wget http://ftp.postgresql.org/pub/source/v9.1.3/postgresql-9.1.3.tar.gz
- tar -xzf postgresql-9.1.3.tar.gz
- cd postgresql-9.1.3
- CPPFLAGS="-I$HOME/include $CPPFLAGS" LDFLAGS="-L$HOME/lib -L/usr/lib64/ $LDFLAGS" \
- ./configure PYTHON="${PYTHON}" --prefix=$HOME --with-pgport=$PGPORT --with-python --disable-thread-safety
- make # 3m 30s
- #make check
- make install
- ############################################################
- # PostGIS (1.5.3)
- # http://postgis.refractions.net/download
- ############################################################
- cd ~/src
- wget http://postgis.refractions.net/download/postgis-1.5.3.tar.gz
- tar -xzf postgis-1.5.3.tar.gz
- cd postgis-1.5.3
- CPPFLAGS="-I$HOME/include $CPPFLAGS" LDFLAGS="-L$HOME/lib -L/usr/lib64/ $LDFLAGS" \
- ./configure --prefix=$HOME \
- --with-gdalconfig=$HOME/bin/gdal-config \
- --with-geosconfig=$HOME/bin/geos-config \
- --with-jsondir=$HOME \
- --with-projdir=$HOME \
- --with-pgconfig=$HOME/bin/pg_config
- make # 50s
- ### make check # can't test PostGIS until you have a database with PostGIS installed up and running.
- make install
- Okay, PostgreSQL should now be installed. After installation, you have some manual post-install setup and configuration to do:
- #####################
- # Post Installation #
- #####################
- # First, make sure that we're using the correct "psql", "createuser", and "createdb" commands:
- export PATH="$HOME/bin:$PATH"
- hash -r
- # Add it to $HOME/.bashrc to make this permanent
- echo 'export PATH="$HOME/bin:$PATH"' >> $HOME/.bashrc
- # Set up DB location
- mkdir $HOME/pgsql
- $HOME/bin/initdb -D $HOME/pgsql/data
- # Start postgresql server
- $HOME/bin/postgres -D $HOME/pgsql/data >> $HOME/pgsql/log 2>&1 &
- # Create the 'postgres' superuser
- createuser -s postgres -P
- # Create a database 'mydb'
- createdb 'mydb'
- # Now, connect to it (Use Ctrl-D to exit)
- psql -U postgres mydb
- Hope that helps!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement