The intention, why i wrote this post is that the possibility having no or very limited Internet connection, is often very common in disasters and remote areas, but it is also crucial to be able to collect and analyze data within your local infrastructure, in my case a Synology NAS.
Prerequisites:
A Synology NAS with DSM 6.x, SSH enabled and following Packages installed:
•Java7
•MariaDB (Standard Username :root password is blank)
•Tomcat6 (No Users set so far for security reasons)
I want to manage my database thru a web interface i also installed:
•phpMyAdmin
•PHP5.6
•WebStation
ODKAggregate:
Download ODK Aggregate v1.N.N. Select the latest release for your operating system.
MySQL Connector/J:
MySQL Connector/J is the official JDBC driver for MySQL
Getting Started:
In this manual i will use the terminal, and vi, vi is the standard editor in the DSM, and it’s not „brain surgery“to use. If you don’t feel comfortable with this, in Windows you can also use WinSCP.
- Login and get root access in terminal:
ssh user@192.168.100.5 <--change "user" and IP address to your settings, the user has to be in the admin group on your DSM. user@192.168.100.5's password: <-- enter the users password user@NAS-WERNA:/$ sudo -i <-- to have root access, enter the users password again root@NAS-WERNA:~# <--now we have root access!
- Navigate to the Tomcat installation directory:
root@NAS-WERNA:~# cd .. <<-- change to the root directory root@NAS-WERNA:/# ls <<-- to list the root directory: bin etc lib opt run tmp var.defaults config etc.defaults lost+found proc sbin usr volume1 dev initrd mnt root sys var volumeUSB1 <-- in my NAS(only 1 HDD) the folder is under volume1 root@NAS-WERNA: cd /volume1/@appstore/Tomcat/src/conf <-- here is the tomcat users file stored root@NAS-WERNA:/volume1/@appstore/Tomcat/src/conf# ls Catalina catalina.properties logging.properties tomcat-users.xml catalina.policy context.xml server.xml web.xml
- Edit the tomcat-users.xml file:
root@NAS-WERNA:/volume1/@appstore/Tomcat/src/conf# ls
Catalina catalina.properties logging.properties tomcat-users.xml catalina.policy context.xml server.xml web.xml
root@NAS-WERNA:/volume1/@appstore/Tomcat/src/conf# vi tomcat-users.xml
when vi opened the document press: "i" for the insert mode in Vi
you have to work with the arrows on your keyboard to move around and remove values,i removed everything in the file and pasted this values:
<?xml version='1.0' encoding='utf-8'?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<tomcat-users>
<role rolename="admin"/>
<role rolename="admin-gui"/>
<role rolename="manager"/>
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<role rolename="manager-jmx"/>
<role rolename="manager-status"/>
<user username="user" password="password" roles="manager-gui,manager-status"/>
</tomcat-users>
~
after inserted change the user and password press "ESC" to leave the Insert mode and enter":wq" to write and quit.
Now we can check if it works:
Navigate with your web browser to http://yourIP:7070/ to see if Tomcat is working, and to http://yourIP:7070/manager/html to see if you have the access, if not, restart tomcat or your NAS.
- Next we create our ODK instance with ODK Aggregate Installer:
Start the Application, accept the Terms, choose a local directory where the WAR file will be stored.
Choose platform: we will use MySQL, as we want to store the DB Locally on our NAS.
SSLCertificate: No, i don’t have an SSL Certificate (As we don’t have an domainname, and also self signed Certificates can cause problems.)
Apache Tomcat Port Configuration:
HTTP/1.1 Connector Port: 7070 (standard in the Synology Tomcat Installation)
IP address: IP of your NAS
Pre-installation Database Requirements:
we have already installed MariaDB which is an SQL Database
the mysql-connector-java-5.x.x-bin.jar we will install later, as we have to deploy ODK instance before.
Database Server Settings:
Portnumber: 3306 hostname: 127.0.0.1 (localhost)
ODK Aggregate database authentication settings:
Enter what you like, and remember it
ODK Aggregate database datastore settings:
leave the value, or adapt it to you needs.
ODK Aggregate Instance Name:
give a name
Super-user ODK Aggregate Username:
give a name.
Next we have to create the SQL Database and User :
Navigate with your browser to: http://yourIP/phpMyAdmin/
the user is root, the password not set yet!
we navigate to: New to create Database we enter the DB Name from the ODK Setup and save it. In User accounts we add User Account enter the Username and Password, as you selected in ODK Setup, and in Global privilleges: check all.
- Now we deploy our ODKAggrgate.war file:
Navigate with your browser to: http://yourIP:7070/manager/html
Scroll down to War file to deploy, select ODKAggrgate.war from where you stored it, and press deploy. If everything worked well, you will have /ODKAggregate und Applications. - Install the mysql-connector-java-5.x.x-bin.jar
This is now easy, as we can access this Folder also with the File Station on our NAS: copy the mysql-connector-java-5.x.x-bin.jar into the Tomcat/ODKAggregate/WEB-INF/lib folder on your Filestation. - Finished!
Now you can connect to http://YourIP:7070/ODKAggregate/Aggregate.html
For ODK Collect the URL will be: http://YourIP:7070/ODKAggregate