Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Building just PostGIS shp2pgsql and raster2pgsql on Ubuntu
apt-get update
apt-get install postgresql-client-9.6 postgresql-server-dev-9.6
#if no postgresql found check what version of Ubuntu you are running
lsb_release -a
#mine read xenial 16.04
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt xenial-pgdg main" >> /etc/apt/sources.list'
wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
apt-get install postgresql-client-9.6 postgresql-server-dev-9.6
#if you don't need to build raster2pgsql you can leave out libgdal-dev
apt-get install libproj-dev libgdal-dev libgeos-dev libxml2 gcc
mkdir projects
cd projects
wget http://download.osgeo.org/postgis/source/postgis-2.3.3.tar.gz
tar -xvf postgis-2.3.3.tar.gz
cd postgis-2.3.3
#in theory adding --prefix=some-path to ./configure should allow you to install shp2pgsql/raster2pgsql
# where you want Ubuntu seems to override or could be bug in PostGIS
./configure
#if you don't need to build raster2pgsql you can do below instead of full ./configure
./configure --without-raster
cd liblwgeom
make && make install
cd ../loader
make && make install
#note that shp2pgsql is installed in /usr/lib/postgresql/9.6/bin
ldconfig
#to test
/usr/lib/postgresql/9.6/bin/shp2pgsql #gives help screen
cd ../raster/loader
make && make install
#note gets installed here
/usr/lib/postgresql/9.6/bin/raster2pgsql
#run (should give you help)
/usr/lib/postgresql/9.6/bin/raster2pgsql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.