Skip to content

Installation Instructions for Ubuntu 12.04 LTS

aegroup edited this page Jun 7, 2013 · 2 revisions

geocommons / geocoder Instruction for Ubuntu Setup of https://github.com/geocommons/geocoder/

Table of Contents

  • General Configuration Prerequisites

    • Install Ruby
    • Sqlite3-ruby * * patch
    • Clone the Geocoder repository
  • Resources

    • Sqlite3 Installation
    • Ruby Versions
    • RVM
    • gem text
    • Ubuntu Flex
    • Ruby Shell
    • Location of the geo/tiger dataset

General Configuration Prerequisites

sudo apt-get update

sudo apt-get install build-essentials

sudo apt-get install make

make -v

gcc -v

sudo apt-get install sqlite3 libsqlite3-dev

sudo apt-get install flex

Install Ruby

curl -L https://get.rvm.io | bash -s stable

rvm requirements

rvm install

rvm alias create default

rvm list

Verify Current Default Ruby Version

rvm list

rvm rubygems current

gem install text

gem install sqlite3-ruby

gem install fastercsv

Sqlite3-ruby patch

git clone git://github.com/schuyler/sqlite3-ruby.git

cd sqlite3-ruby.git

ruby setup.rb config

ruby setup.rb setup

ruby setup.rb install

gem install sqlite3

Clone the Geocoder repository

git clone git://github.com/geocommons/geocoder.git

cd geocoder

make

make install

gem install Geocoder-US-2.0.2pre.gem

Prepare Database Data

mkdir data

mkdir database

cd data

wget -nd -r -A.zip ftp://ftp2.census.gov/geo/tiger/TIGER2011/ADDR/

wget -nd -r -A.zip ftp://ftp2.census.gov/geo/tiger/TIGER2011/FEATNAMES/

wget -nd -r -A.zip ftp://ftp2.census.gov/geo/tiger/TIGER2011/EDGES/

cd ../

Edit the tiger_import script

vim build/tiger_import

SHP2SQLITE=../src/shp2sqlite/shp2sqlite

  • to -

SHP2SQLITE="$BASE/shp2sqlite"

Build the database (Takes about 8 hours on a EC2 VM. I used a spare host 32GB, dual quadcore 2GHZ, took 2.5 hours)

build/tiger_import database/geocoder.db data

chmod +x build/build_indexes

build/build_indexes database/geocoder.db

sudo gem install text --no-rdoc --no-ri

bin/rebuild_metaphones database/geocoder.db

  • or -

ruby bin/rebuild_metaphones database/geocoder.db

(Optional) Download Census Data

https://www.census.gov/geo/maps-data/data/tiger-line.html ftp://ftp2.census.gov/geo/tiger/TIGERrd13/EDGES/

wget -r ftp://ftp2.census.gov/geo/tiger/TIGERrd13/EDGES/

Resources

Sqlite3 Installation http://theplana.wordpress.com/2007/05/11/install-sqlite3-on-ubuntu/

Ruby Versions http://www.ruby-lang.org/en/downloads/

RVM https://www.digitalocean.com/community/articles/how-to-install-ruby-on-rails-on-ubuntu-12-04-lts-precise-pangolin-with-rvm http://stackoverflow.com/questions/8186113/rvm-specify-a-ruby-version-to-use

gem text https://rubygems.org/gems/text

Ubuntu Flex http://flex.sourceforge.net/ http://manpages.ubuntu.com/manpages/hardy/man1/flex.1.html

Location of the geo/tiger dataset https://www.census.gov/geo/maps-data/data/tiger-line.html ftp://ftp2.census.gov/geo/tiger/TIGERrd13/EDGES/

Ruby Shell http://en.wikipedia.org/wiki/Interactive_Ruby_Shell

Program usage:

irb [ options ] [ programfile ] [ argument... ]

Example usage:

irb(main):001:0> n = 5

=> 5

irb(main):002:0> def fact(n)

irb(main):003:1> if n <= 1

irb(main):004:2> 1

irb(main):005:2> else

irb(main):006:2* n * fact(n - 1)

irb(main):007:2> end

irb(main):008:1> end

=> nil

irb(main):009:0> fact(n)

=> 120

Thanks to jeffus https://github.com/geocommons/geocoder/issues/29#issuecomment-4217852