Skip to content
This repository has been archived by the owner on May 24, 2018. It is now read-only.

install prereq

Carlos Rueda edited this page Dec 31, 2015 · 17 revisions

Notes initially adapted from the wiki page describing a host migration of the system. CentOS was the target machine in that opportunity. Package installation commands may need to be changed to the corresponding install commands for the target OS.

Prerequisites

  • JDK 7
  • Apache HTTP server
  • Apache Tomcat
  • AllegroGraph server
  • MySQL
  • BioPortal core

JDK 7

(This link was useful to me.)

Get the latest JDK7 distribution (likely 7u80) available from Oracle, and put it into /opt/MMI-ORR/Downloads.

For a command-line download of the latest, use wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/7u80-b15/jdk-7u80-linux-x64.rpm (derived from this page).

(Note: ideally, we would prefer JDK8, but there's a bug in the underlying Spring library used by Bioportal, so we need to stick with 7.)

These example instructions were performed with jdk-7u21-linux-x64.rpm, as that was used for the TAMU server. Adjust instructions as needed for the version you download.

$ cd /opt/MMI-ORR/Downloads
$ sudo rpm -Uvh jdk-7u21-linux-x64.rpm
$ sudo alternatives --config java
There are 5 programs which provide 'java'.

  Selection    Command
-----------------------------------------------
*+ 1           /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java
   2           /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java
   3           /usr/lib/jvm/jre-1.5.0-gcj/bin/java
   4           /usr/java/latest/jre/bin/java
   5           /usr/java/jdk1.7.0_21/jre/bin/java

Enter to keep the current selection[+], or type selection number: 5
[__@mmisw MMI-ORR]$ java -version
java version "1.7.0_21"
Java(TM) SE Runtime Environment (build 1.7.0_21-b11)
Java HotSpot(TM) 64-Bit Server VM (build 23.21-b01, mixed mode)

Notes regarding the above:

  • Be sure to type selection number 5, and not 1 (despite all that highlighting for #1).
  • After completing the build, edit your .bash_profile file to set JAVA_HOME and PATH, and export the path:

    User variables

    ANT_HOME=/opt/apache-ant-1.9.6 # (You'll add this later) JAVA_HOME=/usr/java/latest

    User specific environment and startup programs

    PATH=$PATH:$HOME/.local/bin:$HOME/bin:$ANT_HOME/bin:$JAVA_HOME/bin

Apache HTTP server (devel)

$ sudo yum install httpd-devel.x86_64

Apache Tomcat

Get the latest Tomcat 7 available from Apache. The following was with apache-tomcat-7.0.40.tar.gz as used for the TAMU server. Adjust instructions as needed.

$ cd /opt/MMI-ORR/Downloads
$ wget "http://apache.mirrors.tds.net/tomcat/tomcat-7/v7.0.40/bin/apache-tomcat-7.0.40.tar.gz"
$ cd /opt/
$ sudo tar zxf ~-/apache-tomcat-7.0.40.tar.gz
$ sudo ln -s /opt/apache-tomcat-7.0.40 ./tomcat
$# if this is the first install on this computer, you will need to add a tomcat user/group
$# sudo adduser tomcat
$ sudo chown -R tomcat:tomcat /opt/tomcat/

Apache Ant

$ cd /opt/MMI-ORR/Downloads
$ wget "http://mirror.cogentco.com/pub/apache//ant/binaries/apache-ant-1.9.0-bin.tar.gz"
$ cd /opt/
$ sudo tar zxf ~-/apache-ant-1.9.0-bin.tar.gz
$ vi ~/.bash_profile  # to set ANT_HOME (to the install directory, no trailing slash), add $ANT_HOME/bin to PATH

Apache and Tomcat configs

Building mod_jk

GCC is required to build the Apache module for Tomcat.

$ sudo yum groupinstall 'Development Tools'
$ gcc --version
gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-3)
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Get the connector, build it, and install it:

$ wget "http://mirror.reverse.net/pub/apache/tomcat/tomcat-connectors/jk/tomcat-connectors-1.2.37-src.tar.gz"

$ cd /opt/MMI-ORR/code
$ tar zxf /opt/MMI-ORR/Downloads/tomcat-connectors-1.2.37-src.tar.gz
$ cd tomcat-connectors-1.2.37-src/
$ # according to BUILD.txt:
$ cd native/
$ ./configure --with-apxs=/usr/sbin/apxs
$ make
$ sudo make install

$ ls -l /usr/lib64/httpd/modules/mod_jk.so
-rwxr-xr-x. 1 root root 1113552 May 20 17:11 /usr/lib64/httpd/modules/mod_jk.so

Edit /etc/httpd/conf/httpd.conf

(This and following edits require use of sudo.)

Add the following after the other LoadModule directives.

LoadModule jk_module modules/mod_jk.so
<IfModule mod_jk.c>
        JKWorkersFile /etc/httpd/conf/workers.properties
        JKLogFile /var/log/httpd/mod_jk.log
        JKLogLevel info
        JkShmFile /var/log/httpd/mod_jk.shm
        JKMount /*.jsp mmi
        JKMount /servlet/* mmi
        JKMount /examples/* mmi
</IfModule>

(and others to enable the mmi worker and configure a number of mappings)

Create /etc/httpd/conf/workers.properties

Define it as the following text, substituting the correct version of the java JDK.

# MMISW
# Define some properties
workers.apache_log=/var/log/httpd/mod_jk.log
workers.tomcat_home=/opt/tomcat
workers.java_home=/usr/java/jdk1.7.0_21
worker.list=mmi
# Set properties for mmi (ajp13)
worker.mmi.type=ajp13
worker.mmi.host=localhost
worker.mmi.port=8009

Update /etc/httpd/conf.d/ssl.conf

If ssl.conf does not exist, mod_ssl likely needs to be installed. Use sudo yum install mod_ssl and the ssl.conf should appear. At the end of the file, before the closing tag, insert the following 4 lines:

...
# MMISW
RewriteEngine On
RewriteCond %{HTTPS} on
RewriteRule ^/(.*) http://%{HTTP_HOST}%{REQUEST_URI}

</VirtualHost>

Tomcat init

Create a /etc/init.d/tomcat file as a copy of the corresponding file on the TAMU deployment. Then:

$ sudo /sbin/chkconfig --add tomcat
$ sudo /sbin/chkconfig --level 345 tomcat on
$ sudo /sbin/chkconfig --list tomcat
tomcat          0:off   1:off   2:off   3:on    4:on    5:on    6:off

At this point Apache HTTP and Tomcat should be completely set up and running.

Try something like curl http://127.0.0.1 for a quick verification.

AllegroGraph server

Note: This step can be postponed until a working ORR deployment is initially in place.

The following based on an installation of AllegroGraph Server 4.14.

Downloaded RPM from http://www.franz.com/agraph/downloads/:

NOTE: for the COR instance, using agraph-4.14.1-1.x86_64.rpm copied from mmisw.

According to http://www.franz.com/agraph/support/documentation/current/server-installation.html

NOTE: the following as run on the COR VM:

$ sudo rpm -i agraph-4.14.1-1.x86_64.rpm

$ sudo /usr/bin/configure-agraph

Welcome to the AllegroGraph configuration program.  This script will
help you establish a baseline AllegroGraph configuration.

You will be prompted for a few settings.  In most cases, you can hit return
to accept the default value.

Location of configuration file to create:
[/etc/agraph/agraph.cfg]:
/etc/agraph does not exist.
Would you like me to create it?:
[y]:
Directory to store data and settings:
[/var/lib/agraph]: /opt/MMI-ORR/workspace/agraph
/opt/MMI-ORR/workspace/agraph does not exist.
Would you like me to create it?:
[y]:
Directory to store log files:
[/var/log/agraph]:
Location of file to write server process id:
[/var/run/agraph/agraph.pid]:
User to run as:
[agraph]:

User 'agraph' doesn't exist on this system.
Create agraph user:
[y]:

Now you must set up an initial user account for AllegroGraph.  This
account will have "super user" privileges in AllegroGraph.

SuperUser account name:
[super]:
SuperUser account password:
SuperUser account password (again):
Instance timeout seconds:
[604800]:

/etc/agraph/agraph.cfg has been created.

If desired, you may modify the configuration.  When you are satisfied,
you may start the agraph service.

You can start AllegroGraph by running:
/sbin/service agraph start

You can stop AllegroGraph by running:
/sbin/service agraph stop

First start:

$ sudo /sbin/service agraph start

AllegroGraph Server Edition 4.14.1, built on August 26, 2014 15:27:56 GMT-0700
Copyright (c) 2005-2014 Franz Inc.  All Rights Reserved.
AllegroGraph contains patented technology.

current-time    : Thursday, December 31, 2015 04:53:59 PM GMT
external-format : utf8-base

Daemonizing...
Server started normally: Running with free license of 5,000,000 triples; no-expiration.
Starting AllegroGraph:                                     [  OK  ]

THE FOLLOWING TO BE UPDATED

AGWebView interface at http://mmisw.tamucc.edu:10035

The mmiorr repository was already created because of previous runs of the Ont service (ie. web interface not needed to create the repo).

$ sudo ls -lrth /opt/MMI-ORR/workspace/agraph/rootcatalog/mmiorr/
total 522M
-rw-r-----. 1 agraph agraph  524 May 20 22:57 parameters.dat
-rw-r-----. 1 agraph agraph    4 May 20 22:57 version
-rw-r-----. 1 agraph agraph   36 May 20 22:57 uuid
-rw-r-----. 1 agraph agraph 4.0G May 20 22:57 deleted
-rw-r-----. 1 agraph agraph 4.0M May 20 22:57 sstab-large-strings
-rw-r-----. 1 agraph agraph 256M May 20 22:57 freelog-307619580
-rw-r-----. 1 agraph agraph 1.5M May 20 22:57 sstab-chunk
-rw-r-----. 1 agraph agraph 4.0M May 20 22:57 sstab-strings
-rw-------. 1 agraph agraph 1.8K May 20 22:57 metadata.2
-rw-r-----. 1 agraph agraph 256M May 27 23:04 tlog-82e85810-d347-acf4-42fe-001dd8b71c56-0
-rw-------. 1 agraph agraph   13 May 27 23:04 ckpt
-rw-r-----. 1 agraph agraph   65 May 27 23:04 tlmgr
-rw-r-----. 1 agraph agraph   23 Jul  4 12:32 instance-info
-rw-r-----. 1 agraph agraph  330 Jul  4 12:32 storage
-rw-------. 1 agraph agraph 1.8K Jul  4 12:32 metadata.0
-rw-r-----. 1 agraph agraph    3 Jul  4 12:32 fti-state

To allow anonymous users to do queries against the mmiorr repository:

AllegroGraph init

THE FOLLOWING RECREATED ON THE COR VM:

    $ sudo /sbin/chkconfig --add agraph
    $ sudo /sbin/chkconfig --level 345 agraph on
    $ sudo /sbin/chkconfig --list agraph
    agraph         	0:off	1:off	2:off	3:on	4:on	5:on	6:off

MySQL

$ sudo yum install mysql-server mysql php-mysql
$ mysql --version
mysql  Ver 14.14 Distrib 5.1.69, for redhat-linux-gnu (x86_64) using readline 5.1
$ sudo /sbin/chkconfig --levels 235 mysqld on
$ sudo /sbin/chkconfig --list  mysqld
mysqld         	0:off	1:off	2:on	3:on	4:off	5:on	6:off
$ sudo /sbin/service mysqld  start
Initializing MySQL database:  Installing MySQL system tables...
OK
...
                                                           [  OK  ]
Starting mysqld:                                           [  OK  ]

$ /usr/bin/mysql_secure_installation
...
Set root password? [Y/n] Y
New password: 
Re-enter new password: 
Password updated successfully!
...
Remove anonymous users? [Y/n] Y
 ... Success!
...
Disallow root login remotely? [Y/n] Y
 ... Success!
...
Remove test database and access to it? [Y/n] n
 ... skipping.
Reload privilege tables now? [Y/n] Y
 ... Success!
...
All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.

BioPortal

A Subversion client program is needed to get the BioPortal code. svn is installed by default on many systems; otherwise you will need to install it.

Code checkout (there is some noise from the BioPortal server, which can be ignored):

$ cd /opt/MMI-ORR
$ mkdir -p code/bioportal
$ cd code/bioportal
$ svn checkout --username anonymous https://bmir-gforge.stanford.edu/svn/bioportal_core/tags/1005
# hit return to enter a blank password

Creation of dbs and users

$ mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 5.5.46 Source distribution

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> create database bioportal;
Query OK, 1 row affected (0.00 sec)

mysql> create database bioportal_protege;
Query OK, 1 row affected (0.00 sec)

mysql> create database bioportal_lexgrid;
Query OK, 1 row affected (0.00 sec)

mysql> create user bioportal_user;
Query OK, 0 rows affected (0.00 sec)

mysql> create user bp_lexgrid_user;
Query OK, 0 rows affected (0.00 sec)

mysql> create user bp_protege_user;
Query OK, 0 rows affected (0.00 sec)

mysql> set password for 'bp_lexgrid_user'@'localhost' = password('xxxx');
Query OK, 0 rows affected (0.00 sec)

mysql> set password for 'bioportal_user'@'localhost' = password('yyyy');
Query OK, 0 rows affected (0.00 sec)

mysql> set password for 'bp_protege_user'@'localhost' = password('zzzz');
Query OK, 0 rows affected (0.00 sec)

mysql> grant all on *.* to 'bioportal_user'@'localhost';
Query OK, 0 rows affected (0.00 sec)

mysql> grant all on *.* to 'bp_lexgrid_user'@'localhost';
Query OK, 0 rows affected (0.00 sec)

mysql> grant all on *.* to 'bp_protege_user'@'localhost';
Query OK, 0 rows affected (0.00 sec)

mysql> exit;
Bye

BioPortal build

$ cd /opt/MMI-ORR/code/bioportal/1005/

Before building BioPortal, edit and adjust WebRoot/WEB-INF/resources/xslt/ontology_light.xsl to add the line <xsl:copy-of select="urn" /> between the corresponding lines for "id" and "displayLabel":

<xsl:copy-of select="id" />
<xsl:copy-of select="urn" />
<xsl:copy-of select="displayLabel"/>

Then, continuing with the BioPortal instructions:

$ cp build.properties.sample build.properties
$ vi build.properties

The properties updated in build.properties are:

bioportal.resource.path=/opt/MMI-ORR/workspace/bioportal/resources
appserver.home=/opt/tomcat
appserver.lib=${appserver.home}/lib     # note: original has .../common/lib
bioportal.jdbc.username=bioportal_user
bioportal.jdbc.password=xxxx
protege.jdbc.username=bp_protege_user
protege.jdbc.password=yyyy
lexgrid.db.user=bp_lexgrid_user
lexgrid.db.password=zzzz

Then you will build and deploy the bioportal.war.

$ mkdir -p /opt/MMI-ORR/workspace/bioportal/resources
$ sudo chown -R `whoami` /opt/MMI-ORR/workspace/bioportal  # to temporarily facilitate the build
$ ant clean
$ ant createwar
$ sudo -E ant deploywar  # -E preserves the environment, so ant can find the Java SDK you just installed
$   # (on my system, needed sudo /opt/apache-ant-1.9.6/bin/ant deploywar to find ant; not sure why)
$ ls -l /opt/tomcat/webapps/bioportal.war  # check that it's there
-rw-r--r--. 1 root root 49577775 May 20 22:35 /opt/tomcat/webapps/bioportal.war

If you have a problem with the first ant deploywar command, you will have to manually remove a few files (ant clean won't do it, even run with sudo). These are (relative to the 1005/ path):

sudo rm src/java/org/ncbo/stanford/resource/generated/message.properties 
sudo rm WebRoot/WEB-INF/resources/config/config.props
sudo rm WebRoot/META-INF/context.xml 
sudo rm WebRoot/WEB-INF/web.xml

Bioportal deployment test

OK. (? - think this gets tested in the main https://github.com/mmisw/mmiorr/wiki/install .)