Open Data KIT tutorial and install with postgres DB

Open Data Kit basic tutorial

Opend Data Kit (ODK) is a free opensource java applications tools for data capturing and aggregate the data and store it in a server. Uses of ODK is for digital surveys instead of the physical paper survey.

Before ODK was introduced, manual surveys have a long process to implement.

The physical paper survey involves decide the questions on the paper survey form, Collecting the survey data and finally aggregate survey data results.Ā 

Advantages of ODKĀ 

  1. Ā Provides Java server for collecting data
  2. Ā Provides Mobile
  3. Eliminate paper survey and make a digital survey

ODK modules

Odk is not a single tool but it has different following modules

  1. ODK Form
  2. ODK Collect
  3. ODK Aggregate

ODK installation on amazon web services

First,Ā generate war file using odk agggregate packe on windows.

the followingĀ  are required to setup ODK on windows

  • Java installationĀ 
  • ODK aggregate package
  • Tomcat
  • Postgres

Download ODK package

Go to the official opendatakit website and download ODK package for corresponding operating system Downloaded ODK Aggregate v1.4.3 windows-installer.exe and click on it for follow the steps.

odk setup

open data kit install

odk install

The above screenshot explains about the folder where odk application.war is deployed

ODK platform amazon

odk on tomcat amazon

odk ssl configuration

odk tomcat configuration

Above ip address is to provide Amazon public IP address

odk postgres setup

odk database configuration

This IP address is the location of an instance where PostgresĀ is installed. ODK and PostgresĀ are installed on the same machine, so providing as Postgres instance

odk aggregate postgres database settings

odk aggregate database settings

This screen talks aboutĀ  odk application database, user details information

odk instance name

odk aggregate email configuration

odk aggregate configuration

setup odk aggregate configuration

odk aggregate configuration success

The above setup creates following files as per below screenshots.

create_db_and_user.sql :- This is SQL script forĀ  creating database odk_prod , user :- odk_user, password: odk_user and granting all privileges for odk_user

ODKAggregate.war :- This is odk aggregate application need to deploy in tomcat server.

odk SQL and war files

Postgres Installation

Please install postgres. Once postgresĀ is installed, please follow below steps to create odk database,Ā odk users

  1. Execute the Postgres SQL shell (psql) commandline client using the postgres username and password (the password you chose during the installation of the database), and supply the create_db_and_user.sql to it. To open the psql commandline client, open a cmd window (Windows), terminal window (MacOS) or term window (Linux) and ā€˜cdā€™ to the directory containing the psql client (psql.exe on Windows). Then, please type:

  2. psql ā€“username postgres

And enter the PostgreSQL server password. You will then be within the psql commandline client. You should see a ā€˜postgres=#ā€™ prompt. Type:

\cd D:/odksetup/ODKAGG~1

\i create_db_and_user.sql


Here is what this looks like on Windows, with what you must type in red:

Microsoft Windows [Version 6.1.7600]

Copyright (c) 2009 Microsoft Corporation.Ā  All rights reserved.

C:\Windows\System32>cd ā€œ\Program Files\PostgreSQL\9.0\binā€

C:\Program Files\PostgreSQL\9.0\bin>psql.exe ā€“username postgres

Password for user postgres:*******

psql (9.0.4)

WARNING: Console code page (437) differs from Windows code page (1252)

8-bit characters might no work correctly. See psql reference

page ā€œNotes for Windows usersā€ for details.

Type ā€œhelpā€ for help.

postgres=# \cd D:/odksetup/ODKAGG~1

postgres=# \i create_db_and_user.sql





WARNING: Console code page (437) differs from Windows code page (1252)

8-bit characters might no work correctly. See psql reference

page ā€œNotes for Windows usersā€ for details.

You are now connected to database ā€œodk_prodā€.



odk_prod=# \q

C:\Program Files\PostgreSQL\9.0\bin>

Next step is to install java and tomcat. once installed deploy war to tomcat

Odk application deploy to tomcat

copy the ODKAggregate.war to the /var/lib/tomcat6/webapps/ODKAggregate directory of the Apache Tomcat installation.

Self SSL security generation on UbuntuĀ 

Please generate the certificate using the following command.Ā 

sudo keytool -genkey -alias admin -keypass adminpass -keystore certificate.jks -storepass adminpass

The above command generates certificate.jks in the current folder. Please copy certificate.jks file to /var/lib/tomcat6/conf and add/modify below entries in /var/lib/tomcat6/conf/server.xml

<?xml version="1.0" encoding="UTF-8"?>  
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true" maxThreads="150" scheme="https" secure="true" clientAuth="false" sslProtocol="TLS" keystoreFile="conf/certificate.jks" keystorePass="adminpass" />  

8443 is SSL port for tomcat and 8080 is for normal HTTP request
Next step is to start Apache Tomcat server(if not already started)

visit http://ipaddress:8080/ODKAggregate/ and go to the Management / Permissions tab to complete configuring the access rights for ODK Aggregate.

Similar Posts