Skip to content

Instantly share code, notes, and snippets.

@evz
Created March 8, 2012 14:44
Show Gist options
  • Save evz/2001300 to your computer and use it in GitHub Desktop.
Save evz/2001300 to your computer and use it in GitHub Desktop.
2010 Census - setting up a basic environment
apt-get install git-core
apt-get install python-software-properties
add-apt-repository ppa:pitti/postgresql # PPA for PostgreSQL 9.0
add-apt-repository ppa:ubuntugis/ubuntugis-unstable # PPA for current GIS libs
apt-get update
apt-get install libgdal1-dev libgeos-dev proj python-dev libpq-dev postgresql-server-dev-9.0 postgresql-contrib-9.0 python-gdal mongodb mdbtools
apt-get install git-core
git clone https://github.com/ireapps/census.git
cd census/censusweb/
vi requirements.txt # Comment out GDAL line
pip install -r requirements.txt
wget http://postgis.refractions.net/download/postgis-1.5.3.tar.gz
tar -xvf postgis-1.5.3.tar.gz
cd postgis-1.5.3/
./configure
make
make install
su - postgres # Switch to postgres superuser
psql
### Inside pgsql shell
postgres=# create user censusweb with password 'Xy9XKembdu'; # Create new user to match the one in settings.py
postgres=# \q
### Back to bash
psql -d postgres -c "UPDATE pg_database SET datistemplate='true' WHERE datname='template_postgis';"
psql -d template_postgis -f /usr/share/postgresql/9.0/contrib/postgis-1.5/postgis.sql
psql -d template_postgis -f /usr/share/postgresql/9.0/contrib/postgis-1.5/spatial_ref_sys.sql
psql -d template_postgis -c "GRANT ALL ON geometry_columns TO PUBLIC;"
psql -d template_postgis -c "GRANT ALL ON geography_columns TO PUBLIC;"
psql -d template_postgis -c "GRANT ALL ON spatial_ref_sys TO PUBLIC;"
exit # Switch back to root
python manage.py runserver
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment