The install process is rather complicated, so I would recommend scanning through this page first and making sure you understand what's going on.
git clone git://github.com/codeforamerica/openblight.git
brew update
brew install postgres postgis
Follow the post-installation instructions for postgres. If you missed them, run brew info postgres
. Finally, create a default postgres
user:
createuser -sdl postgres
Now we have to create the databases and add the PostGIS extension to them.
First create a template database with support for raster + topology:
createdb template_postgis -U postgres
psql -U postgres -d template_postgis -f /usr/local/share/postgis/postgis.sql
psql -U postgres -d template_postgis -f /usr/share/postgresql/9.1/contrib/postgis-2.0/spatial_ref_sys.sql
psql -U postgres -d template_postgis -f /usr/share/postgresql/9.1/contrib/postgis-2.0/rtpostgis.sql
psql -U postgres -d template_postgis -f /usr/share/postgresql/9.1/contrib/postgis-2.0/topology.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 /usr/local/var/postgres/pg_hba.conf
Check for the presence of this line
local all all trust
Save the file and reload the server:
pg_ctl -D /usr/local/var/postgres restart
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;
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