Skip to content

FirstTimeInstallation

bgreenwood edited this page Jul 16, 2012 · 13 revisions

This installation tutorial is based on installation of the ANDS Services on a CentOS 6 operating system. ANDS envisages that all the open source software in the software stack will be compatible with various other Linux distributions, but does not support/provide installation notes for these operating systems.

ANDS recommends using the Nectar Research Cloud as a testing platform for deploying the software stack. A preconfigured image may be available in the near future -- please contact us if you are interested in helping out!

1. Initial System configuration

From a stock Centos 6 installation, run a yum update to ensure that the kernel and system libraries are up-to-date.

We also recommend disabling SELinux. Whilst it is possible to run the ANDS Online Services under an enforcing SELinux environment, we find this to usually cause more trouble than anything else. Follow these instructions to disable SELinux permanently. Then restart your server (shutdown -r now).

The ANDS software dependencies are easily resolved by configuring 3rd-party software repositories including EPEL and REMI:

  • Download the latest version of the EPEL RPM from: http://mirror.optus.net/epel/6/i386/repoview/epel-release.html
  • Download the latest version of the REMI RPM from: http://blog.famillecollet.com/pages/Config-en
  • Download the latest version of JPackage from: http://www.jpackage.org/
  • Install these RPMs using rpm -Uvh <filename>.rpm

Example:

wget http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-7.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
rpm -Uvh http://mirrors.dotsrc.org/jpackage/6.0/generic/free/RPMS/jpackage-utils-5.0.0-7.jpp6.noarch.rpm
rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm jpackage-utils*.rpm

You must also ensure that the jpackage repository is setup correctly or your system will install java from openjdk-1.5.0 (which is not compatible with the ANDS stack):

cd /etc/yum.repos.d/
wget http://www.jpackage.org/jpackage50.repo

Now edit the /etc/yum.repos.d/remi.repo file and under the [remi] block set enabled=1and add the line exclude=mysql*

Now would be a good time to do some system housekeeping:

yum update

Thats step 1 complete!


2. Installing additional software dependencies

Apache Web Server (httpd)

Install httpd, php and other required libraries by executing:

yum install httpd php-pgsql php-mbstring php-xml php-devel php-pdo

This should give you a basic Apache installation with configuration files in /etc/httpd/ and a default web root of /var/www/ (web files in /var/www/htdocs/). It also installs the most recent PHP version in the REMI repository (currently PHP 5.3). ANDS Online Services requires PHP 5.x.

PostgreSQL Database Server

Install the latest version of PostgreSQL (currently tested against version 9.1) using the instructions here

Example:

wget http://yum.postgresql.org/9.1/redhat/rhel-6-i386/pgdg-centos91-9.1-4.noarch.rpm
rpm -ivh pgdg-centos91-9.1-4.noarch.rpm
yum install postgresql91 postgresql91-server

Next, install the server software:

yum install postgresql91 postgresql91-server postgresql91-contrib
mv /etc/init.d/postgresql-9.1 /etc/init.d/postgresql   # rename this to avoid future pain

This will install PostgreSQL server. The default location of the data directory (which also contains the server configuration files) is /var/lib/pgsql/9.1/data

Tomcat 6 (java application server)

yum install java
yum install tomcat6
yum install ant ant-contrib   # used to build the ANDS web applications
wget http://jdbc.postgresql.org/download/postgresql-9.1-902.jdbc4.jar
mv postgresql-9.1-902.jdbc4.jar /usr/share/tomcat6/lib/

This will install tomcat6 with configuration files in /etc/tomcat6/ and web apps deployed from /var/lib/tomcat6/

SOLR Indexer

Visit http://lucene.apache.org/solr/mirrors-solr-latest-redir.html to get the latest SOLR distribution (currently tested against SOLR 3.6, experimental testing against SOLR 4 has begun). Extract this into /usr/local/solr36

Example:

cd /usr/local/
wget http://apache.mirror.uber.com.au/lucene/solr/3.6.0/apache-solr-3.6.0.tgz
tar xfz apache-solr-3.6.0.tgz
mv apache-solr-3.6.0 solr36

SOLR 3.6 is now installed in /usr/local/solr36/

Gearman (background task daemon)

  • Follow the instructions contained http://www.webtatic.com/ here to install the webtatic repository. It is disabled by default, which is just as well as it often contains bleeding-edge software.
  • Install gearmand and php-pecl-gearman using the repository

Example:

rpm -Uvh http://repo.webtatic.com/yum/centos/6/latest.rpm
yum install gearmand php-pecl-gearman --enablerepo=webtatic

Make these services start on server boot

Add httpd, postgresql, tomcat6, gearmand to chkconfig to start them as services when the server reboots.

Example:

chkconfig httpd on
chkconfig postgresql on
chkconfig tomcat6 on
chkconfig gearmand on

3. Configuring the ANDS Services

Configuring your firewall (iptables)

Firewall should allow public access to the following ports 80, 8080

Example (note: test these rules thoroughly in your own environment before applying them)

iptables -F INPUT
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -p icmp -j ACCEPT
iptables -A INPUT -i lo -j ACCEPT
iptables -I INPUT 3 -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
iptables -I INPUT 3 -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
iptables -I INPUT 3 -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
iptables -A INPUT -j REJECT --reject-with icmp-host-prohibited
iptables -A FORWARD -j REJECT --reject-with icmp-host-prohibited
service iptables save

Note (Nectar Users): Nectar also has a VM-level firewall that is configured when you launch the virtual machine. You should ensure that the applicable ports are accessible at this level too. This is configured on the Nectar Dashboard.

Get the latest version of the ANDS Online Services:

Visit the Git repository to get a version of ANDS Online Services. ANDS policy is that stable releases will be tagged, the master branch will reflect the latest production release and develop will include all current development code (usually unstable).

Example:

# this will create a directory named au-research-ANDS...
wget https://github.com/au-research/ANDS-Online-Services/tarball/release7 
tar xfz release7

# and this will copy the code into the web directory root
cp -r au-research-ANDS-Online-Services-849612a/registry/src/* /var/www/html/

Setting up the database

Firstly, initialise the database with a UTF character set:

service postgresql initdb en_AU.UTF-8
service postgresql start

Change to the postgres user and import the databases:

su postgres -
psql

# Following commands are executed from the postgres shell:
CREATE USER webuser;
CREATE USER dba;
CREATE DATABASE dbs_cosi ENCODING = 'UTF8' LC_COLLATE = 'en_AU.UTF-8' LC_CTYPE = 'en_AU.UTF-8';
ALTER DATABASE dbs_cosi OWNER TO dba;
GRANT CONNECT, TEMPORARY ON DATABASE dbs_cosi TO webuser;
GRANT ALL ON DATABASE dbs_cosi TO dba;

CREATE DATABASE dbs_orca ENCODING = 'UTF8' LC_COLLATE = 'en_AU.UTF-8' LC_CTYPE = 'en_AU.UTF-8';
ALTER DATABASE dbs_orca OWNER TO dba;
GRANT CONNECT, TEMPORARY ON DATABASE dbs_orca TO webuser;
GRANT ALL ON DATABASE dbs_orca TO dba;
\q 

# and now import the database files
psql -d dbs_cosi -f /var/www/au-research-ANDS-Online-Services-*/registry/db/cosi_setup.sql
psql -d dbs_orca -f /var/www/au-research-ANDS-Online-Services-*/registry/db/orca_setup.sql

Now to finish things off, we need to add the database permissions! Use exit to go back to the root user.

Open /var/lib/pgsql/9.1/data/pg_hba.conf and add the line:

host    all             all            127.0.0.1/32            trust

Now restart postgresql by service postgresql restart

TODO: Editing global config!

  • Database host=127.0.0.1
  • Harvester build_wars (tomcat servlet?)
  • Harvester database (add user harvester;)
  • R7: putharvestdata in application_config, other harvester conf in application_environment
Clone this wiki locally