Thursday, February 20, 2014

Getting started with Apache Cordova using Fedora 20 for Android Development

Part 1: Setup Development Environment

1. Install required Software

  • Download and install Java SE SDK from Oracle (http://www.oracle.com/java) or use OpenJDK
    • Download the latest RPM. In my case it's jdk-7u51-linux-x64.rpm
    • Install it running
      sudo rpm -ihv jdk-7u51-linux-x64.rpm
    • Usually now you'll find your JDK here /usr/java/jdk1.7.0_51
    • There are also symbolic links pointing to the latest and default Java version
  • Install NodeJS and it's Package Mager npm:
    sudo yum install nodejs npm ant
  • Install Cordova:
    sudo npm install -g cordova
  • Download the Android Developer Tools Bundle for Linux from http://developer.android.com/sdk/index.html

2. Prepare your Development Environment

2.1. Setup Android Developer Tools

  • I've choosen ~/Development as my main directory for development purposes
  • Create a directory for ADT:
    mkdir ~/Development/adt
  • Move the ADT Bundle to your adt-Directory:
    mv ~/Downloads/adt-bundle-linux-x86_64-20131030.zip ~/Development/adt
  • Unzip the Bundle:
    cd ~/Development/adt
    unzip adt-bundle-linux-x86_64-20131030.zip

2.2. Set Oracle Java as your default Java Installation

  • Install Oracle Java as a new alternative:
    • sudo update-alternatives --install "/usr/bin/java" "java" "/usr/java/latest/bin/java" 2
    • sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/java/latest/bin/javac" 2
  • Set Oracle Java as the used one:
    • sudo update-alternatives --set "java" "/usr/java/latest/bin/java"
    • sudo update-alternatives --set "javac" "/usr/java/latest/bin/javac"

2.3. Prepare your environment

  • Open your ~/.bash_profile with your favourite text editor; i.e.
    vi ~/.bash_profile
  • Add the following lines at the very bottom of the file:
    JAVA_HOME=/usr/java/latest
    export JAVA_HOME
    JDK_HOME=/usr/java/latest
    export JDK_HOME
    PATH=$PATH:$JAVA_HOME/bin
    PATH=$PATH:~/Development/adt/adt-bundle-linux-x86_64-20131030/sdk/platform-tools
    export PATH
  • Run the following commando to apply your changed profile:
    . ~/bash_profile

3. Start Eclipse

  • Run the following command to start Eclipse:
    ~/Development/adt/adt-bundle-linux-x86_64-20131030/eclipse/eclipse
  • Now it's time to choose your workspace. In my case it's ~/Development/android-workspace
  • After you've choosen your workspace Eclipse should be ready to start with your first Android project

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