PostgreSQL and PostGIS on Ubuntu 15.10

These are my install notes for PostgreSQL 9.5:
In this scenario I assume you do not have PostgreSQL installed and that you are going to install PostgreSQL with the PostGIS extentions on a server with no GUI. We are going to install directly from the apt repository provided by postgresql.org. I plan to use this database in conjunction with my WildFly server. My install notes for setting up Wildfly 10.0.0.Final can be found here: https://gesker.wordpress.com/2016/02/09/wildfly-10-on-ubuntu-15-10/

On the server…

Elevate to root:
sudo -s

Add apt.postgresql.org to you apt repository lists:
sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'

Install base packages:
aptitude update
aptitude install --with-recommends wget ca-certificates
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
aptitude dist-upgrade
aptitude install --with-recommends postgresql-9.5 postgresql-contrib-9.5 postgis postgresql-9.5-postgis-2.2

Become user postgres:
su postgres

Add user/role to the database system:
createuser -s -P wildfly <– You will be prompted for a password. Remember your credentials. User will be a SUPERUSER in this case.

Add a database with the user wildfly (from above) as the owner:
createdb -O wildfly -E UTF8 wildflyDb

On your workstation…

Launch PgAdmin3 and connect using the credentials you setup above. Run the following against the wildflyDb to enable the PostGIS extentions:

CREATE EXTENSION IF NOT EXISTS postgis;
CREATE EXTENSION IF NOT EXISTS postgis_topology;
CREATE EXTENSION IF NOT EXISTS fuzzystrmatch;
CREATE EXTENSION IF NOT EXISTS address_standardizer;
CREATE EXTENSION IF NOT EXISTS address_standardizer_data_us;
CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder;

Enable a couple more extentions that are very useful:
CREATE EXTENSION IF NOT EXISTS btree_gist;
CREATE EXTENSION IF NOT EXISTS pgcrypto;

3 thoughts on “PostgreSQL and PostGIS on Ubuntu 15.10

  1. Most recent packages as of 2015-Dec-05 seem to be:

    aptitude install –with-recommends postgresql-9.6 postgresql-contrib-9.6 postgis postgresql-9.6-postgis-2.3

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s