EWX config

From CHG-Wiki
Jump to navigationJump to search

This page documents the process of installing EWX on different operating systems.

Windows Server 2008 r2

Updating EWX with EROS Python Requirements

Per ederer's request, Libby performed the following updates on chg2 to bring the EWX installation in line with the EROS setup:

  • Installed python27 (python27 was already installed as part of ArcGIS 10.1, but because that particular version may be needed by ArcGIS, python-2.7.8.amd64.msi was installed along side it).
  • Added a PYTHONPATH environment variable and added %PYTHONPATH% to path environment variable.
  • Tested python installation by
    • Opened DOS window
    • Entered 'python and enter'
      • Success!
  • Installed numpy using the installation provided in the 'EWX_package_for_Greg' folder in chg2's ftproot (it is an exe).
  • MS Visual C++ 2008 Redistributable 64x already installed (this is required by GDAL).
  • Installed GDAL core (used gdal-111-1600-x64-core.msi, 'package for Greg' version is gdal-110-1500-x64-core.msi)
    • Added GDAL (C:\Program Files\GDAL) to 'path' in environment variable.
    • Installed GDAL python binding ('package for Greg' version is GDAL-1.10.0.win-amd64-py2.7, installed GDAL-1.11.0.win-amd64-py2.7.msi)
    • Created environment variables (are we sure these aren't reversed?)
      • GDAL_DATA - C:\Program Files\GDAL\gdalplugins
      • GDAL_DRIVER_PATH - C:\Program Files\GDAL\gdal-data
    • Tested GDAL installation by
      • Opened DOS window
      • Entered 'gdalinfo' --version
      • Success!
  • Extracted geos-3.2.2-1.tar.bz2 (downloaded from www.filewatcher.com/m/geos-3.2.2-1.tar.bz2.427238-0.html before Libby was aware of the 'package for Greg' folder).
  • Added geos_c.dll to C:\Python27\Lib\site-packages\shapely\DLLs
    • Added GEOS_LIBRARY_PATH - C:\Python27\Lib\site-packages\shapely\DLLsgeos_c.dll environment variable.
  • Installed pip
    • Copied get-pip.py to python27 folder from EWX_package_for_Greg\PythonInstallation\pip.
    • In a command prompt, navigated to python27 folder and entered 'python get-pip.py'.
      • (to upgrade) python -m pip install -U pip
  • Installed Shapely
    • Used executable found in 'EWX_package_for_Greg\PythonInstallation\Shapely' (Shapely-1.3.0.win-amd64-py2.7.exe).
      • (to upgrade) python -m pip install Shapely --upgrade
  • Installed rasterstats module
    • Enter into command prompt:
python -m pip install https://pypi.python.org/packages/source/r/rasterstats/rasterstats-0.3.3.tar.gz 

(Downloads and install only when new version is needed.)

python -m pip install rasterstats 

(Downloads and installs.)

  • Replaced the rasterStats module with EROS's updated source code (found in 'package for Greg' folder) by placing main.py in C:\Python27\Lib\site-packages\rasterstats (old main.py saved as main-org.py)
  • Tested installation by running 'rasterstat_test.py' script to ensure it runs without errors ('rasterstat_test.py' ran with some errors, but they seem to be due to filepath issues originating from the fact that all EROS scripts are filepath specific for the EROS server and do not match chg2's.)
    • 'rasterstat_test.py is in 'EWX_package_for_Greg\PythonInstallation\scripts'.


Ubuntu 12.04.5 LTS (Precise Pangolin)

CentOS 6.5

Required Packages/Settings for EWX

  • Python 2.7
  • Java 7 (GeoServer not yet compatible Java 8)
  • PostgreSQL
  • MariaDB
  • numpy
  • Git client
  • Tomcat 8
  • Maven 3.x
  • GEOS
  • GDAL (Documentation needed)
  • GDAL-python binding (Documentation needed)
  • Shapely (Documentation needed)
  • rasterstats (Documentation needed)
    • After installing rasterstats, its EROS main.py and ATT00001.htm

PostgreSQL

See: https://wiki.postgresql.org/wiki/YUM_Installation

[root@chg-ewx ~]# vib #/etc/yum.repos.d/CentOS-Base.repo

Add the text below to the [base] and [updates] sections

exclude=postgresql*
[root@chg-ewx ~]# yum install postgresql
[root@chg-ewx ~]# yum install postgresql93-server.x86_64

Leaving database configuration up to ederer.

Initialize database

[root@chg-ewx ~]# service postgresql-9.3 initdb

Start PostgreSQL when server starts

[root@chg-ewx ~]# chkconfig postgresql-9.3 on

Python 2.7

See:

[root@chg-ewx ~]# yum groupinstall -y development
[root@chg-ewx ~]# wget http://www.python.org/ftp/python/2.7.6/Python-2.7.6.tar.xz

yum info xz-libs is already installed

[root@chg-smb ~]# xz -d Python-2.7.6.tar.xz
[root@chg-smb ~]# tar -xvf Python-2.7.6.tar
[root@chg-ewx ~]# cd Python-2.7.6
[root@chg-ewx Python-2.7.6]# ./configure
[root@chg-ewx Python-2.7.6]# make

altinstall to not clobber system defaults

[root@chg-ewx Python-2.7.6]# make altinstall

Example: export PATH="[/path/to/installation]:$PATH"

[root@chg-ewx ~]# export PATH="/usr/local/bin:$PATH"
[root@chg-ewx ~]# alias python=python2.7
pip
[root@chg-ewx Python-2.7.6]# wget --no-check-certificate https://pypi.python.org/packages/source/s/setuptools/setuptools-1.4.2.tar.gz
[root@chg-ewx Python-2.7.6]# tar -xvf setuptools-1.4.2.tar.gz
[root@chg-ewx Python-2.7.6]# cd setuptools-1.4.2
[root@chg-ewx setuptools-1.4.2]# python2.7 setup.py install
[root@chg-ewx Python-2.7.6]# curl https://raw.githubusercontent.com/pypa/pip/master/contrib/get-pip.py | python2.7 -

Java 7

Install the Oracle version of Java 7 (because GeoServer is not currently compatiable with Java 8 and certain EWX modules require the Oracle version) See: http://www.unixmen.com/install-oracle-java-jdk-8-centos-76-56-4/ Using firefox (because Oracle requires a cookie for download) download jdk 7 64-bit RPM

http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
[root@chg-ewx ~]# cd Downloads;ls -la
total 123720
drwx------.  2 root root      4096 Dec 10 16:20 .
dr-xr-x---. 12 root root      4096 Dec 10 16:20 ..
-rw-r--r--.  1 root root 126679286 Dec 10 16:16 jdk-7u71-linux-x64.rpm
[root@chg-ewx Downloads]# rpm -ivh jdk-7u71-linux-x64.rpm 
Preparing...                ########################################### [100%]
   1:jdk                    ########################################### [100%]
Unpacking JAR files...
 rt.jar...                   
 jsse.jar...                      
 charsets.jar...                      
 tools.jar...                             
 localedata.jar...                   
 jfxrt.jar...                           
[root@chg-ewx ~]# export JAVA_HOME=/usr/java/jdk1.7.0_71
[root@chg-ewx ~]# export PATH=$PATH:$JAVA_HOME
[root@chg-ewx ~]# vi /etc/profile.d/java.sh
##!/bin/bash
JAVA_HOME=/usr/java/jdk1.7.0_71/
JAVA_OPTS=”-XX:MaxPermSize=1024m”
PATH=$JAVA_HOME/bin:$PATH
export PATH JAVA_HOME JAVA_OPTS
export CLASSPATH=.
[root@chg-ewx ~]# chmod +x /etc/profile.d/java.sh
[root@chg-ewx ~]# source /etc/profile.d/java.sh

Download jre in firefox with URL

http://download.oracle.com/otn-pub/java/jdk/7u71-b14/jdk-7u71-linux-x64.rpm
[root@chg-ewx Downloads]# export JAVA_HOME="/usr/java/latest"
[root@chg-ewx Downloads]# export JAVA_HOME="/usr/java/jre1.7.0_71"

Java plug-in?

http://scientificlinuxforum.org/index.php?showtopic=2695
[root@chg-ewx ~]# ln -s /usr/java/jre1.7.0_71/lib/amd64/libnpjp2.so /usr/lib64/mozilla/plugins/libnpjp2.so

GeoServer

In order to support the EWX Snippets, GeoServer must be configured to fulfill JSONP requests. The following goes in the GeoServer web.xml.

<context-param>
    <param-name>ENABLE_JSONP</param-name>
    <param-value>true</param-value>
</context-param>

Maven 3.x

See: http://www.unixmen.com/install-apache-ant-maven-tomcat-centos-76-5/

[root@chg-ewx ~]# wget http://www.eng.lsu.edu/mirrors/apache/maven/maven-3/3.2.3/binaries/apache-maven-3.2.3-bin.zip
[root@chg-ewx ~]# unzip apache-maven-3.2.3-bin.zip
[root@chg-ewx ~]# mv apache-maven-3.2.3/ /opt/maven
[root@chg-ewx ~]# ln -s /opt/maven/bin/mvn /usr/bin/mvn

Create a file called maven.sh under /etc/profile.d/ directory.

[root@chg-ewx ~]# vi /etc/profile.d/maven.sh

Add the following contents:

#!/bin/bash
MAVEN_HOME=/opt/maven
PATH=$MAVEN_HOME/bin:$PATH
export PATH MAVEN_HOME
export CLASSPATH=.
[root@chg-ewx profile.d]# mvn -version
Apache Maven 3.2.3 (33f8c3e1027c3ddde99d3cdebad2656a31e8fdf4; 2014-08-11T13:58:10-07:00)
Maven home: /opt/maven
Java version: 1.7.0_71, vendor: Oracle Corporation
Java home: /usr/java/jre1.7.0_71
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "2.6.32-504.1.3.el6.x86_64", arch: "amd64", family: "unix"
[root@chg-ewx ~]# java -version
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

Tomcat 8

[root@chg-ewx ~]# wget http://mirror.sdunix.com/apache/tomcat/tomcat-8/v8.0.15/bin/apache-tomcat-8.0.15.zip
[root@chg-ewx ~]# unzip apache-tomcat-8.0.15.zip
[root@chg-ewx ~]# mv apache-tomcat-8.0.15/ /opt/tomcat
[root@chg-ewx ~]# vi /etc/profile.d/tomcat.sh

Add the following:

#!/bin/bash
CATALINA_HOME=/opt/tomcat
PATH=$CATALINA_HOME/bin:$PATH
export PATH CATALINA_HOME
export CLASSPATH=.

[root@chg-ewx ~]# chmod +x /etc/profile.d/tomcat.sh
[root@chg-ewx ~]# source /etc/profile.d/tomcat.sh
[root@chg-ewx ~]# chmod +x $CATALINA_HOME/bin/startup.sh
[root@chg-ewx ~]# chmod +x $CATALINA_HOME/bin/shutdown.sh
[root@chg-ewx ~]# chmod +x $CATALINA_HOME/bin/catalina.sh
[root@chg-ewx ~]# chmod +x $CATALINA_HOME/bin/catalina.sh
[root@chg-ewx ~]# cd $CATALINA_HOME/bin
[root@chg-ewx bin]# ./startup.sh
Using CATALINA_BASE:   /opt/tomcat
Using CATALINA_HOME:   /opt/tomcat
Using CATALINA_TMPDIR: /opt/tomcat/temp
Using JRE_HOME:        /usr/java/jre1.7.0_71
Using CLASSPATH:       /opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/tomcat-juli.jar
Tomcat started. 

Autostart Tomcat

[root@chg-ewx bin]# vi /etc/init.d/tomcat

Copy/paste the following lines in it.

#!/bin/sh
chkconfig: 2345 80 20
# Description: Tomcat Start/Shutdown script
export JAVA_HOME=/usr/java/jdk1.7.0_71
case $1 in
start)
cd /opt/tomcat/bin/
./startup.sh
;;
stop)
cd /opt/tomcat/bin/
./shutdown.sh
;;
restart)
cd /opt/tomcat/bin/
./shutdown.sh
cd /opt/tomcat/bin/
./startup.sh
;;
esac
exit 0

Yum-able packages (MariaDB, numpy, git client)

[root@chg-ewx ~]# yum install MariaDB-server MariaDB-client numpy

GEOS

See: http://trac.osgeo.org/geos/

    http://trac.osgeo.org/geos/wiki/BuildingOnUnixWithAutotools
[root@chg-ewx ewx]# svn checkout http://svn.osgeo.org/geos/trunk geos-svn

gcc and gcc=c++ already installed and updated

[root@chg-ewx ewx]# cd geos-svn
[root@chg-ewx geos-svn]# ./autogen.sh
[root@chg-ewx geos-svn]# ./configure
***snip***
Swig: false
Python bindings: false
Ruby bindings: falsevirsh
PHP bindings: false
[root@chg-ewx geos-svn]# make
[root@chg-ewx geos-svn]# make check

Test passed!

[root@chg-ewx geos-svn]# make install

Notes

  • Ederer is taking care of:
    • Locating and installing the correct packages for GDAL.
    • Installing/configuring the GDAL-python binding.
    • Locating and installing Unix packages for Shapely.
    • Installing rasterstats module and replacing necessary files with updated EROS code.
    • Check on pip and git to make sure they are functioning correctly.
    • Any other EROS specific configurations or packages needed.
    • Documentation of setup process.