Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hale/2843358 to your computer and use it in GitHub Desktop.
Save hale/2843358 to your computer and use it in GitHub Desktop.
Complete instructions for how to get Code For America's OpenBlight Dashboard working on Ubuntu 12.04 Precise Pangolin (LTS) (64bit)

Installation of OpenBlight Dashboard on Ubuntu 12.04 LTS (64bit)

The install process is rather complicated, so I would recommend scanning through this page first and making sure you understand what's going on.

1) Grab the files.

git clone git://github.com/codeforamerica/openblight.git

2) Install PostGIS.

Follow these instructions to install PostGIS 2.0 and PostgreSQL 9.1. Stop once you reach 'Connecting to your new database'.

Amendments to the instructions

In order to successfully build GEOS 3.3.3, you will need ruby1.8 and its source code. Since I am using rbenv, I had to take the following steps before step 3/4:


1) Add an environment variable so that rbenv-build keeps the source code. (Replace .zshenv with whichever shell you use).

echo 'export CONFIGURE_OPTS=--enable-shared' >> .zshenv
exec $SHELL

2) Install ruby 1.8.x with rbenv-build

rbenv install 1.8.7-p358 --keep

3) Configure rbenv to locally use ruby1.8

cd geos-3.3.3
rbenv local 1.8.7-p358

3) Configure PostGIS and set up the database

I assume at this point you have successfully installed PostGIS. Now we have to create the databases and add the PostGIS extension to them.

First create a template database with support for raster + topology:

sudo -u postgres createdb template_postgis
sudo -u postgres psql -d template_postgis -f /usr/share/postgresql/9.1/contrib/postgis-2.0/postgis.sql
sudo -u postgres psql -d template_postgis -f /usr/share/postgresql/9.1/contrib/postgis-2.0/spatial_ref_sys.sql
sudo -u postgres psql -d template_postgis -f /usr/share/postgresql/9.1/contrib/postgis-2.0/postgis_comments.sql

sudo -u postgres psql -d template_postgis -f /usr/share/postgresql/9.1/contrib/postgis-2.0/rtpostgis.sql
sudo -u postgres psql -d template_postgis -f /usr/share/postgresql/9.1/contrib/postgis-2.0/raster_comments.sql

sudo -u postgres psql -d template_postgis -f /usr/share/postgresql/9.1/contrib/postgis-2.0/topology.sql
sudo -u postgres psql -d template_postgis -f /usr/share/postgresql/9.1/contrib/postgis-2.0/topology_comments.sql

Next create the databases:

1) Ensure the local postgres access has uninhibited access to the database. (For more information see the documentation).

sudo gedit /etc/postgresql/9.1/main/pg_hba.conf`

Edit this line...

local   all             postgres                                ident

...to be:

local   all             postgres                                trust

2) Reload the postgresql server:

sudo /etc/init.d/postgresql reload

3) Open an interactive terminal and create the two databases:

Check results with \l.

psql -U postgres -d template1
CREATE DATABASE openblight_test;
CREATE DATABASE openblight_dev;

Now we can spatially enable them:

psql -u postgres -D openblight_dev
CREATE EXTENSION postgis;
CREATE EXTENSION postgis_topology;
\q
psql -u postgres -D openblight_test
CREATE EXTENSION postgis;
CREATE EXTENSION postgis_topology;

4) Final steps

Install the required gems

bundle install

Load the database schema

rake db:schema:load

Prepare the test database

rake db:test:prepare

By now everything should be set up. Check it's all working by running the test suite:

rake spec
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment