Sunday, March 30, 2014

Create an ODK Aggregate AppEngine Instance from Ubuntu 12.04

This tutorial is mainly picked from ODK tutorial here, with a few **nix additions to make a smooth installation for Linux users.

First and foremost why would and Rstats guy be doing with ODK, now think twice - when working with mobile data collection, there is no better tool out there than ODK and it works seamlessly with Google AppEngine. Google AppEngine allows easy hosting of your applications, and your applications' data, on an online server. Learn more about AppEngine and read the terms of service.
For this tutorial, you will set up your own server using AppEngine infrastructure and ODK Aggregate. ODK Aggregate allows you to set up a ready-to-deploy server where you can upload your form submissions, export them as .csv files and send them on to other services like Fusion Tables.
  1. First, you'll need to set up a Google AppEngine account. If this is your first time using AppEngine, Google will send you a text message to confirm your identity, so have a text-enabled phone ready. Note: A given mobile number can only be used once for creating an AppEngine instance.
  2. Once you've confirmed your mobile number and logged in, click "Create an Application."
  3. Give your application an "Application Identifier." This will become part of the URL for your AppEngine instance, e.g. "myurl.appspot.com."
  4. (If you would like to restrict the permissions for who can access your data, read the Security section below. You can edit the Security settings in this step.)
  5. For this tutorial, we will use the default "Open to all Google Account Users." Once you've entered an identifier, you will receive confirmation that your application has registered successfully.
  6. Download the latest version of ODK Aggregate from the ODK Aggregate v1.N.N page.
  7. Unzip it and for Ubuntu Linux i turns into something like ODK Aggregate vx.x.x linux-x64-installer.run file.
  8. Now this is where many people get a little lost - how do you run the .run files. First make sure that the file is executable.  Enter at terminal: “chmod +x filename.run” Then also enter: “./filename.run” with executes and brings setup wizard. You will enter the ODK Aggregate Setup Wizard. Click "Next."
  9. You will be prompted to agree to ODK Aggregate's License Agreement. Then, select the location on your computer where you want the installer files to store the software that will run on Google AppEngine.
  10. Run the Setup Wizard. Enter the ODK instance name (e.g. "odkfunite" for odkfunite.appspot.com) and the Google account associated with that instance.
  11. Once the Setup Wizard finishes configuring ODK Aggregate, you'll be prompted to run the installation script. Note that for Linux you can also run the script manually from the terminal but make sure it is executable,  “chmod +x filename.sh” Then also enter: “./filename.sh” this will then run on your terminal.
Watch out:


Errors “Exception in thread "main" java.lang.UnsupportedClassVersionError: com/google/appengine/tools/admin/AppCfg : Unsupported major.minor version 51.0”


Solution:
Make sure you got Java 7 and above for the latest Aggregate version - check this from Linux terminal by command “java -version”. In addition, make sure that if you already installed java 7, then in the priority list its running first. Command “sudo update-alternatives --config java” and select the number to make it default as shown below.



  • To get a list of your installed Java platforms, run the following command from the terminal:
    sudo update-alternatives --config java
    This will give you a list output similar to this:
    There are 2 choices for the alternative java (providing /usr/bin/java).
       Selection    Path                                           Priority   Status
      ------------------------------------------------------------
      0            /usr/lib/jvm/java-6-oracle/jre/bin/java         1070      auto mode
      1            /usr/lib/jvm/java-7-openjdk-i386/jre/bin/java   1051      manual mode
    * 2            /usr/lib/jvm/java-6-openjdk-i386/jre/bin/java   1069      manual mode
    Press enter to keep the current choice[*], or type selection number: 


  1. You'll be prompted to enter the Google Account and password associated with the AppEngine instance again.
  2. Wait 3-10 minutes for the script to run. Once it's finished, you'll get a "Success" message. If you made a mistake entering the information in the Setup Wizard, you'll find out in this stage. You can re-run the Setup Wizard by going back to the folder where you installed ODK Aggregate and double-click the installer to run it again.
  3. Congratulations! When the script is finished running, ODK Aggregate is now installed on your AppEngine instance. When it's finished running, confirm that it's set up correctly by visiting your AppEngine url (e.g. myurl.appspot.com). You can sign in with your Google Account or click "Anonymous Access" to get in.

1 comment:

Add any comments if it helped :)