Project

General

Profile

Install Adaguc on Ubuntu » History » Version 34

« Previous - Version 34/77 (diff) - Next » - Current version
Maarten Plieger, 05/30/2017 12:12 PM


Install Adaguc on Ubuntu

xUbuntu LTS 16.04.2

Install packages

sudo apt-get install vim kate kwrite konsole g++ m4 ncview curl git
sudo apt-get install postgresql postgresql-server-dev-all postgresql-client postgresql-client-common  postgresql-contrib 
sudo apt-get install libcurl4-openssl-dev libcairo2-dev libxml2-dev libgd2-xpm-dev libudunits2-dev udunits-bin netcdf-bin libnetcdf-dev libhdf5-dev libproj-dev libgdal-dev 
sudo apt-get install default-jre default-jdk maven

Setup postgresql

sudo -u postgres createuser --superuser adaguc
sudo -u postgres psql postgres -c "ALTER USER adaguc PASSWORD 'adaguc';" 
sudo -u postgres psql postgres -c "CREATE DATABASE adaguc;" 
echo "\q" | psql "dbname=adaguc user=adaguc password=adaguc host=localhost" 
if [ ${?} -eq 0 ];then
    echo "Postgres database setup correctly" 
fi

Install tomcat

sudo mkdir -p /src/
sudo chown -R adaguc: /src
cd /src/
curl -L http://mirrors.supportex.net/apache/tomcat/tomcat-8/v8.0.44/bin/apache-tomcat-8.0.44.tar.gz > apache-tomcat-8.0.44.tar.gz
tar -xzvf apache-tomcat-8.0.44.tar.gz

printf "export CATALINA_HOME=\"/src/apache-tomcat-8.0.44\"\n\
export CATALINA_BASE=\"/src/apache-tomcat-8.0.44\"\n\
export ADAGUC_SERVICES_CONFIG=/src/config/adaguc-services-config-tomcat.xml\n\
export JAVA_HOME=\"/usr\"\n\
CONTENT_ROOT=-Dtds.content.root.path=/src/apache-tomcat-8.0.44/content\n\
JAVA_PREFS_ROOTS=\"-Djava.util.prefs.systemRoot=$CATALINA_HOME/content/thredds/javaUtilPrefs -Djava.util.prefs.userRoot=$CATALINA_HOME/content/thredds/javaUtilPrefs\"\n\
NORMAL=\"-d64 -Xmx4096m -Xms512m -server -ea\"\n\
HEAP_DUMP=\"-XX:+HeapDumpOnOutOfMemoryError\"\n\
HEADLESS=\"-Djava.awt.headless=true\"\n\
JAVA_OPTS=\"$CONTENT_ROOT $NORMAL $MAX_PERM_GEN $HEAP_DUMP $HEADLESS $JAVA_PREFS_ROOTS\"\n\
export JAVA_OPTS" > /src/apache-tomcat-8.0.44/setenv.sh

Install adaguc-services

sudo mkdir -p /src/KNMI
sudo chown -R adaguc: /src
mkdir -p /src/config
sudo mkdir -p /data
sudo chown -R adaguc: /data
mkdir -p /data/adaguc-services-base
mkdir -p /data/adaguc-services-space
cd /src/KNMI
git clone https://github.com/KNMI/adaguc-services
cd /src/KNMI/adaguc-services
mvn package
cp ./target/adaguc-services-1.0.0-SNAPSHOT.war /src/apache-tomcat-8.0.44/webapps/adaguc-services.war

# Configure adaguc-services
printf "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\
<adaguc-services>\n\
  <external-home-url>http://localhost:8080/adaguc-services/</external-home-url>\n\
  <basedir>/data/adaguc-services-base</basedir>\n\
  <userworkspace>/data/adaguc-services-space</userworkspace>\n\
  <server>\n\
    <port>8080</port>\n\
  </server>\n\
  <security>\n\
    <keystore>/src/keystore.jks</keystore>\n\
    <keystorepassword>password</keystorepassword>\n\
    <keystoretype>JKS</keystoretype>\n\
    <keyalias>tomcat</keyalias>\n\
  </security>\n\
  <adaguc-server>\n\
    <adagucexecutable>/src/KNMI/adaguc-server/bin/adagucserver</adagucexecutable>\n\
    <export>ADAGUC_PATH=/src/KNMI/adaguc-server/</export>\n\
    <export>ADAGUC_CONFIG=/src/KNMI/adaguc-server/data/config/adaguc.docker.xml</export>\n\
    <export>ADAGUC_DATARESTRICTION=FALSE</export>\n\
    <export>ADAGUC_FONT=/src/KNMI/adaguc-server/data/fonts/FreeSans.ttf</export>\n\
  </adaguc-server>\n\
</adaguc-services>" > /src/config/adaguc-services-config-tomcat.xml

Install adaguc-viewer

cd /src/apache-tomcat-8.0.44/webapps
git clone https://github.com/KNMI/adaguc-viewer/
printf "\n\
xml2jsonrequestURL = '/adaguc-services/xml2json?'\n\
" >> adaguc-viewer/config.js

Install adaguc-server

sudo mkdir -p /src/KNMI
sudo chown -R adaguc: /src
sudo mkdir -p /data/
sudo chown -R adaguc: /data
mkdir /data/adaguc-autowms
mkdir /data/adaguc-datasets
cd /src/KNMI
git clone https://github.com/KNMI/adaguc-server
cd /src/KNMI/adaguc-server
bash compile.sh
cp /src/KNMI/adaguc-server/data/datasets/testdata.nc /data/adaguc-autowms/

Start tomcat

. /src/apache-tomcat-8.0.44/setenv.sh
/src/apache-tomcat-8.0.44/bin/startup.sh

Visit http://localhost:8080/adaguc-viewer/?service=http%3A%2F%2Flocalhost%3A8080%2Fadaguc-services%2Fadagucserver%3Fservice%3Dwms%26request%3Dgetcapabilities%26source%3Dtestdata.nc


Installation instructions for Ubuntu 15.04

sudo apt-get install mercurial
sudo apt-get install build-essential
sudo apt-get install libcurl4-openssl-dev libcairo2-dev libxml2-dev libgd2-xpm-dev 
sudo apt-get install libudunits2-dev udunits-bin
sudo apt-get install sqlite3 libsqlite3-dev
sudo apt-get install netcdf-bin libnetcdf-dev libhdf5-dev
sudo apt-get install libproj-dev
sudo apt-get install libgdal-dev

cd ~ 
hg clone https://dev.knmi.nl/hg/adagucserver
cd adagucserver
bash compile.sh

#Done!

Full Installation instructions for xubuntu-14.04.2-desktop-amd64

Install packages using the package manager

sudo apt-get install vim
sudo apt-get install kate kwrite konsole
sudo apt-get install postgresql
sudo apt-get install libcurl4-openssl-dev libcairo2-dev libxml2-dev libgd2-xpm-dev postgresql-server-dev-all postgresql-client
sudo apt-get install mercurial
sudo apt-get install libudunits2-dev udunits-bin
sudo apt-get install php5
sudo apt-get install php5-gd
sudo apt-get install g++
sudo apt-get install m4
sudo apt-get install sqlite3 libsqlite3-dev
sudo apt-get install ncview 

Setup postgresql and create a database


### Setup postgres for adaguc: ###
sudo -u postgres createuser --superuser adaguc
sudo -u postgres psql postgres 
\password adaguc 
\q
# note: type adaguc as password, when finished press \q to exit.

createdb adaguc

Setup directories (/data/)

#Setup directories under /data/
sudo mkdir /data
sudo chown adaguc /data
mkdir /data/software/
mkdir -p /data/www/htdocs
mkdir -p /data/services/cgi-bin
mkdir /data/tmp
chmod 777 /data/tmp
mkdir /data/log
chmod 777 /data/log

Setup apache www server

### setup apache configuration point to /data/www/ directories ###

sudo vi /etc/apache2/sites-enabled/000-default.conf 

<VirtualHost *:80>
    ServerAdmin webmaster@localhost

    DocumentRoot /data/www/htdocs
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory /data/www/htdocs/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /data/services/cgi-bin/
    <Directory "/data/services/cgi-bin">
        AllowOverride None
        Options +ExecCGI -MultiViews +FollowSymLinks 
        Order allow,deny
        Allow from all
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

#In /etc/apache2/apache2.conf, change /var/www to /data
sudo vi /etc/apache2/apache2.conf 

#Enable CGI mods
sudo cp /etc/apache2/mods-available/cgi*  /etc/apache2/mods-enabled/

#Restart the service
sudo apache2ctl restart

# In order to test whether CGI scripts are functioning, place the following file in /data/services/cgi-bin/ with name helloworld.cgi

#!/bin/bash
echo "Content-type: text/html" 
echo ''
echo Hello world!

#Make this file executable
chmod +x /data/services/cgi-bin/ helloworld.cgi

#Check if only "Hello world!" is displayed in a web browser:
http://localhost/cgi-bin/helloworld.cgi

Install libraries from source (HDF5, NetCDF4, Proj, GDAL)

### Install latest hdf,netcdf and gdal libraries ###

export CPPFLAGS="-I/data/build/include/" 
export LDFLAGS="-L/data/build/lib/" 
export LD_LIBRARY_PATH="/data/build/lib/:$LD_LIBRARY_PATH" 
export PATH="/data/build/bin/:$PATH" 

#You can add these exports to the .bashrc file

#HDF5
cd /data/software
wget http://www.hdfgroup.org/ftp/HDF5/current/src/hdf5-1.8.15-patch1.tar
tar -xvf hdf5-1.8.15-patch1.tar.gz 
cd hdf5-1.8.15-patch1/
./configure --prefix=/data/build
make
make install

#NetCDF4
cd /data/software
wget ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-4.3.3.1.tar.gz
tar -xzvf netcdf-4.3.3.1.tar.gz 
cd netcdf-4.3.3.1
./configure --prefix=/data/build
make
make install

#Proj4
cd /data/software/
wget http://download.osgeo.org/proj/proj-4.9.1.tar.gz
tar -xzvf proj-4.9.1.tar.gz
cd proj-4.9.1
./configure --prefix=/data/build
make
make install

#GDAL
cd /data/software
wget http://download.osgeo.org/gdal/1.11.2/gdal-1.11.2.tar.gz
tar -xzvf gdal-1.11.2.tar.gz 
./configure --prefix=/data/build
make
make install

Install ADAGUC

After this procudere has been followed, ADAGUC can be installed in the following way:

### Install adaguc server: ###
cd /data/software/
hg clone http://dev.knmi.nl/hg/adagucserver
cd adagucserver
bash compile.sh
cp ./bin/* /data/build/bin/

#Install adaguc viewer
cd /data/www/htdocs/
hg clone http://dev.knmi.nl/hg/adagucviewer

#visit http://localhost/adagucviewer/ with a web browser

Complete, you have installed the ADAGUC software suite!

Create a sharedfolder in virtualbox

This enables data sharing between the host and guest system.

On the host system
  • Go to Devices/Shared Folders settings...
  • Add a "Machine folder" which points to a directory you wish to share and give it the Folder name "vboxshare"
  • Enable Auto-mount and Make permanent

On the guest system

mkdir /data/vboxshare
sudo mount -t vboxsf vboxshare /data/vboxshare

You can now share files between the host and guest systems

Old Installation instructions for xubuntu 11.10

sudo apt-get install vim
sudo apt-get install kate kwrite konsole
sudo apt-get install virtualbox-guest-additions virtualbox-guest-x11 virtualbox-guest-utils virtualbox-guest-source virtualbox-guest-dkms virtualbox-guest-additions-iso
sudo apt-get install postgresql
sudo apt-get install libcurl4-openssl-dev libcairo2-dev libxml2-dev libgd2-xpm-dev  libproj-dev postgresql-server-dev-all postgresql-client
sudo apt-get install mercurial
sudo apt-get install libudunits2-dev udunits-bin
sudo apt-get install php5
sudo apt-get install php5-gd

#Setup postgres for adaguc:
sudo -u postgres createuser --superuser adaguc
sudo -u postgres psql postgres
\password adaguc # type adaguc as password, when finished press \q to exit.
\q

createdb adagucdemo

#Setup directories under /data/
sudo mkdir /data
sudo chown adaguc /data
mkdir /data/software/
mkdir -p /data/www/htdocs
mkdir -p /data/www/cgi-bin
mkdir /data/tmp
chmod 777 /data/tmp
mkdir /data/log
chmod 777 /data/log

#Install latest hdf,netcdf and gdal libraries

export CPPFLAGS="-I/data/build/include/" 
export LDFLAGS="-L/data/build/lib/" 
export LD_LIBRARY_PATH="/data/build/lib/:$LD_LIBRARY_PATH" 
export PATH="/data/build/bin/:$PATH" 

#You can add these exports to the .bashrc file

#HDF5
cd /data/software
wget http://www.hdfgroup.org/ftp/HDF5/current/src/hdf5-1.8.11.tar.gz
tar -xzvf hdf5-1.8.11.tar.gz 
cd hdf5-1.8.11/
./configure --prefix=/data/build
make
make install

#NetCDF4
cd /data/software
wget http://www.unidata.ucar.edu/downloads/netcdf/ftp/netcdf-4.3.0.tar.gz
tar -xzvf netcdf-4.3.0.tar.gz 
cd netcdf-4.3.0/
./configure --prefix=/data/build --enable-netcdf-4
make
make install

#GDAL
cd /data/software
wget http://download.osgeo.org/gdal/1.10.0/gdal-1.10.0.tar.gz
tar -xzvf gdal-1.10.0.tar.gz 
 #Install GDAL ADAGUC driver (optional)
cd gdal-1.10.0/frmts/netcdf
wget http://trac.osgeo.org/gdal/raw-attachment/wiki/ADAGUC/GDAL_ADAGUC_source_v0.3.tar.gz
tar -xzvf GDAL_ADAGUC_source_v0.3.tar.gz
mv GDAL_ADAGUC_source_v0.3/* .
#vi GNUMakefile and add  adagucdataset.o to the OBJ list
vi /data/software/gdal-1.10.0/frmts/gdalallregister.cpp
 # add GDALRegister_ADAGUC(); between GMT and NetCDF drivers
vi /data/software/gdal-1.10.0/gcore/gdal_frmts.h 
 # add void CPL_DLL GDALRegister_ADAGUC(void); between GMT and NetCDF drivers
#Continue compiling GDAL
cd /data/software/gdal-1.10.0/
./configure --prefix=/data/build LIBS="-ludunits2" 

make
make install

# Setup Apache www server
# Configure /etc/apache2/sites-enabled/000-default to point to /data/www/htdocs and /data/www/cgi-bin
sudo apache2ctl restart

### The environment has now been setup completely for the ADAGUC installation ###

After this procudere has been followed, ADAGUC can be installed in the following way:

#Install adaguc server:
cd /data/software/
hg clone http://dev.knmi.nl/hg/adagucserver
cd adagucserver
bash compile.sh

#Install adaguc viewer
cd /data/www/htdocs/
hg clone http://dev.knmi.nl/hg/adagucviewer

#visit http://localhost/adagucviewer/ with a web browser