Tuesday, February 18, 2014

Installation of an OpenStreetMap server on CentOS 6.5

1. Preparations

  • sudo yum update
  • sudo yum groupinstall 'Development Tools'
  • sudo yum install pycairo.x86_64 pycairo-devel.x86_64 geos geos-devel protobuf-devel

2. Add EPEL and ELGIS Repositories

2.1. EPEL

3. Install PostgreSQL Server and PostGIS

5. Build and install Mapnik

5.1. Boost C++ Libriaries


  • Downlad latest Boost sources here: http://sourceforge.net/projects/boost/files/boost and untar it
  • Change to untared boost directory and run ./bootstrap.sh
  • Now build boost running ./b2
  • The build process will take a long time (depending on your CPU). Stay calm ;)
  • Now install boost running sudo ./b2 install

5.2. Build Mapnik

Build Preparation


  • export PATH=$PATH:/usr/pgsql-9.3/bin (to add pg_config to the PATH)

Clone Mapnik GIT Repos



Build Mapnik


  • ./configure
  • make

5.3. Install Mapnik


  • sudo make install

6. Install OpenStreetMap

  • useradd -c "OpenStreetMap System User" -m osm
  • su - postgres
  • export PATH=$PATH:/usr/pgsql-9.3/bin
  • psql gis < /usr/pgsql-9.3/share/contrib/postgis-2.1/postgis.sql
  • psql gis < /usr/pgsql-9.3/share/contrib/postgis-2.1/spatial_ref_sys.sql
  • echo "grant all on geometry_columns to apache;" | psql gis
  • echo "grant all on spatial_ref_sys to apache;" | psql gis
  • createuser osm -W
  • echo "grant all on geometry_columns to osm;" | psql gis
  • echo "grant all on spatial_ref_sys to osm;" | psql gis
  • exit
  • su - osm
  • export PATH=$PATH:/usr/pgsql-9.3/bin
  • mkdir osm
  • cd osm
  • git clone https://github.com/openstreetmap/osm2pgsql.git
  • cd osm2pgsql
  • ./autogen.sh
  • ./configure
  • make
  • export PATH=$PATH:~/osm/osm2pgsql
  • cd ~
  • mkdir tmp
  • cd tmp
  • wget http://download.geofabrik.de/europe/austria-latest.osm.bz2
  • bunzip2 austria-latest.osm.bz2
  • osm2pgsql -S ~/osm/osm2pgsql/default.style austria-latest.osm

References/Sources

4 comments:

  1. What version of CentOs did you take ? the minimalist or the classic one ?
    Thank you ;)

    ReplyDelete
  2. yum install pycairo.x86_64 pycairo-devel.x86_64 geos geos-devel protobuf-devel

    No package geos available.
    No package geos-devel available.
    No package protobuf-devel available.


    ????

    ReplyDelete
    Replies
    1. i had to install elgis and epel before the installation of geos because it's in there. also you forgot to mention that the pgsql devel package is required, otherwise the compile of mapnik will fail because it cant find the libpq-fe.h.

      Delete
  3. Do you have also a guide to install and configure mod_tile (or similar) on Centos 6.x?

    ReplyDelete