-
Notifications
You must be signed in to change notification settings - Fork 4
Installation
This manual has been released on 15/04/2013. Check the project's wiki for an actual version of this installation manual.
This manual describes how to install QualitySCHU step by step. For this installation you will need Ubuntu Server 12.04.2 LTS (Precise Pangolin) which you will be able to get here. The installation was tested on a computer with Pentium III processor running at 2.66GHz, 512MB RAM, and a free harddisk space of 8GB.
Please read this installation manual carefully and make sure to precisely follow its steps as described below. Finally you will be the lucky administrator of an easy to maintain, fast accessable, and light-weight QualitySCHU server which contains an Apache webserver with a PostGIS database and an istSOS sensor observation service, that is able to mark outliers by running a statistical method powered by the free software programming language R.
If you are ready to start, please log in on to your system as a common user (which is recommended) with the right to execute sudo commands (which is required).
QualitySCHU will make use of the Apache webserver.
-
Install Apache2
sudo apt-get install apache2 -
Install mod_wsgi
sudo apt-get install libapache2-mod-wsgi -
set default Document read
The parsers for LANUV and COSM are written in Python.
sudo apt-get install python-psycopg2
QualitySCHU will make use of BeautifulSoup to parse the LANUV data.
sudo apt-get install python-beautifulsoup
QualitySCHU will make use of Dateutil for avoiding problems with summertime changes. It is an extension of the standard module datetime.
sudo apt-get install python-dateutil
QualitySCHU will make use of PostGIS, which requires PostgreSQL. PostgreSQL is an open source object-relational database management system.
sudo apt-get install postgresql
After finishing the installation routine, alter the password:
sudo -u postgres psql
alter user postgres password 'postgres';
PostGIS adds support for geographic objects to PostgreSQL.
sudo apt-get install postgresql-9.1-postgis
QualitySCHU will make use of the sensor observation service istSOS. This part of the installation will be the most difficult one, so make sure you are awake and motivated to keep on installing QualitySCHU. Please note, that this part of the installation manual is close to the istSOS's tutorial. We strongly recommend to have a look at it.
- Download and unzip istSOS to /usr/local/:
wget https://istsos.googlecode.com/files/istSOS-2.0-RC2.tar.gz
sudo tar -zxvf istSOS-2.0-RC2.tar.gz -C /usr/local/istsos/istsosRC2/
- Set execution permission and owner for the folders services and logs:
sudo chmod 755 -R /usr/local/istsos/istsosRC2/istsos
sudo chown -R www-data:www-data /usr/local/istsos/istsosRC2/istsos/services
sudo chown -R www-data:www-data /usr/local/istsos/istsosRC2/istsos/logs
- Configure Apache and WSGI
sudo vim /etc/apache2/sites-enabled/000-default
Add the following lines just before the closing tag </VirtualHost>:
WSGIScriptAlias /istsos /usr/local/istsos/istsosRC2/istsos/application.py
Alias /istsos/admin /usr/local/istsos/istsosRC2/istsos/interface
-
Restart Apache
sudo /etc/init.d/apache2 restart -
Create PostGIS database
sudo -u postgres createdb -E UTF8 istsos2
sudo -u postgres psql -d istsos2 -f /usr/share/postgresql/9.1/contrib/postgis-1.5/postgis.sql
sudo -u postgres psql -d istsos2 -f /usr/share/postgresql/9.1/contrib/postgis-1.5/spatial_ref_sys.sql
Your istSOS should be running now. Check the installation success on the browser by loading the page http://localhost/istsos/admin or type another adress, if you did not install the server on your local machine but on a remote server.
From this point use the istSOS-GUI to configure your qualitySCHU server.
- Press the database button
Server > Database
user: postgres
password: postgres
host: localhost
port: 5432
DB name: istsos2
- Press the service provider button to configure your service provider informations
Server > Service provider
use your institutional information
- Press the service identification button to configure the service identification information
Server > Service identification
describe the service with metadata
- Press the Coordinates systems button to configure your service coordinates system
Server > Coordinates system
set your default EPSG code, other permitted coord. systems, name of the axis
- Press the GetObservation Configuration button to configure your getobservation request options.
Server > GetObservation configuration
set maximum interval per request and no data aggregation value
- Press the Proxy Configuration button to configure your service proxy adress.
Server > Proxy configuration
set the address of the istsos service
- The istSOS has a feature for setting a maximum period for data retrievement requests to avoid server overloads. But we want to be able to request all data. Therefore download this modified GO_filter.py to the following folder on your server and replace the old one: /YOUR_INSTALL_FOLDER/istsos/istsoslib/filters.
After you have done this you must restart your apache2 server!
sudo /etc/init.d/apache2 restart
Now you will be able to go via the istSOS admin interface to Server > GetObservation configuration and set 0 (=zero) for Max Request interval (hours)
- Create the LANUV service. Press the New service button and set the requested values:
Server > New service
set the service name (*lanuv*) and EPSG (*4326*) and database connections
- Create the observed properties
lanuv > Observed properties
Name: temperature
Definition URN: urn:ogc:def:parameter:x-istsos:1.0:meteo:air:temperature
Description:
Name: humidity
Definition URN: urn:ogc:def:parameter:x-istsos:1.0:meteo:air:humidity
Description:
Name: nitrogen dioxide
Definition URN: urn:ogc:def:parameter:x-istsos:1.0:meteo:air:no2
Description:
Name: nitrogen monoxide
Definition URN: urn:ogc:def:parameter:x-istsos:1.0:meteo:air:nmono
Description:
Name: ozone
Definition URN: urn:ogc:def:parameter:x-istsos:1.0:meteo:air:ozone
Description:
Name: pm10
Definition URN: urn:ogc:def:parameter:x-istsos:1.0:meteo:air:pm10
Description:
Name: sulfur dioxide
Definition URN: urn:ogc:def:parameter:x-istsos:1.0:meteo:air:so2
Description:
Name: wind velocity
Definition URN: urn:ogc:def:parameter:x-istsos:1.0:meteo:air:wv
Description:
- Define the units of measures. Use the admin interface once again, go to Services > lanuv and press the Units of measures button.
lanuv > Units of measures
Code: deg
Description: Celsius degree
Code: %
Description: percentage
Code: m/s
Description: meter per seconds
Code: mug
Description: microgramm per cubic meter
- Add the first lanuv procedure.
Visit the lanuv station website and open the Station.js file. Take the first station in the list (VACW) and create it. You will find the coordinates in WGS84 for each station in the linked Station.js file and the z-Value (height) under the station links on the lanuv website
Name: VACW
Description: fill in your own description
Keywords: fill in your own keywords
System type: insitu-fixed-point
Sensor type: lanuv
FOI name: VACW
EPSG: 4326
Coordinates: x: 6.09576 y: 50.7730 z: 163
Outputs:
Observed property: urn:ogc:def:parameter:x-istsos:1.0:meteo:air:temperature
Unit od measure: deg
Observed property: urn:ogc:def:parameter:x-istsos:1.0:meteo:air:humidity
Unit od measure: %
Observed property: urn:ogc:def:parameter:x-istsos:1.0:meteo:air:wv
Unit od measure: m/s
Observed property: urn:ogc:def:parameter:x-istsos:1.0:meteo:air:nmono
Unit od measure: mug
Observed property: urn:ogc:def:parameter:x-istsos:1.0:meteo:air:no2
Unit od measure: mug
Observed property: urn:ogc:def:parameter:x-istsos:1.0:meteo:air:ozone
Unit od measure: mug
Observed property: urn:ogc:def:parameter:x-istsos:1.0:meteo:air:pm10
Unit od measure: mug
Observed property: urn:ogc:def:parameter:x-istsos:1.0:meteo:air:so2
Unit od measure: mug
- Once you have created the first station you can use the tool copy configuration from exisiting procedure:
Now go through the list of stations and create the stations by copying a procedure and just changing the following variables: - Name
- FOI Name
- coordinates (x,y,z)
We are sorry that there is no script for it but it is only a work of 20 minutes ;)
Now the lanuv SOS is ready!
- Create the LANUV service. Press the New service button and set the requested values:
Server > New service
set the service name (*cosmcosm*) and EPSG (*4326*) and database connections
- Create the observed properties
lanuv > Observed properties
Name: temperature
Definition URN: urn:ogc:def:parameter:x-istsos:1.0:meteo:air:temperature
Description:
Name: humidity
Definition URN: urn:ogc:def:parameter:x-istsos:1.0:meteo:air:humidity
Description:
Name: nitrogen dioxide
Definition URN: urn:ogc:def:parameter:x-istsos:1.0:meteo:air:no2
Description:
Name: carbon monoxide
Definition URN: urn:ogc:def:parameter:x-istsos:1.0:meteo:air:co
Description:
- Define the units of measures. Use the admin interface once again, go to Services > cosmcosm and press the Units of measures button.
cosmcosm > Units of measures
Code: deg C
Description: Celsius degree
Code: %
Description: percentage
Code: ppm
Description: parts per million
Now the cosm SOS is ready! It will be filled by the QualitySCHU parsers. You will find more information about this topic in the cronjobs section.
- QualitySCHU will use R with ODBC for connecting the PostgreSQL database.
sudo apt-get install r-cran-rodbc - Install ODBC driver for PostgreSQL
sudo apt-get install unixODBC odbc-postgresql - Edit odbcinst.ini by using an editor of your choice. In this example we have used vim.
sudo vim /etc/odbcinst.ini
[PostgreSQL]
Description = PostgreSQL driver for Linux & Windows
Driver = /usr/lib/x86_64-linux-gnu/odbc/psqlodbcw.so
Setup = /usr/lib/x86_64-linux-gnu/odbc/libodbcpsqlS.so
- Configure connection to database
sudo vim /etc/odbc.ini
[ODBC Data Sources]
mydb1 = Database description
[mydb1]
Driver = /usr/lib/x86_64-linux-gnu/odbc/psqlodbcw.so
Database = istsos2
Servername = localhost
Username = your_username
Password = your_password
Protocol = 8.2.5
ReadOnly = 0
Port = 5432
[ODBC]
InstallDir = /usr/lib
Congratulations! You are nearly done! Now all requirements to run the QualitySCHU software are on your server. Note: QualitySCHU has been developed by using GitHub. In order to get this amazing software running on your server you have to clone the QualitySCHU GitHub repository.
- Change to /var/www
cd /var/www - Clone Repo
sudo git clone git://github.com/mpfeil/qualitySCHU.git
You might wish to know what is happening on your server and you might be tired of starting the parsers manually - so why don't you let cronjobs do the work for you? In this last topic you will learn how to start the required stuff manually and how to edit the crontab in a senseless way.
- LANUV-Parser
python /var/www/qualitySCHU/Parser/LANUV/main.pywill start the parser for the LANUV data manually. The parser default logging file is /var/www/logs/lanuv.log - COSM-Parsers
python /var/www/qualitySCHU/Parser/COSM/newandupdate.pywill start the parser for looking up if there are new AirQualityEggs out on COSM which are not registered in the SOS. The parser default logging file is /var/www/logs/cosmnewandupdate.log
python /var/www/qualitySCHU/Parser/COSM/fetchData.pywill start the parser for the COSM air quality egg data manually. The parser default logging file is /var/www/logs/cosmfetchData.log - Validation
Rscript /var/www/qualitySCHU/Validation/validationLANUV.Rwill start the validation script for the LANUV data manually.
To automatically run the jobs, add them to your crontab by typing crontab -e to edit your crontab. We recommend to run the LANUV parser hourly and the LANUV validation script daily. Look here for more information or refer to the cron and crontab manpage.
