Thursday, September 18, 2014

How to start APACHE TIKA file daemon on start or add service

Create file /etc/init.d/tika

nano /etc/init.d/tika

insert follow content


#!/bin/sh
# Starts, stops, and restarts Tika Server.
#
# chkconfig: 35 92 08 description: Starts and stops Tika server
# Written by David Braslavsky

TIKA_DIR="/usr/local/src/tika-1.5/tika-server/target/" JAVA_OPTIONS="-Xmx2048m  -jar tika-server-1.5.jar --hostname=hostname --port=9998"
LOG_FILE="/var/log/tika.log"
JAVA="/usr/bin/java"

case $1 in
    start)
        echo "Starting Tika"
        cd $TIKA_DIR
        $JAVA $JAVA_OPTIONS 2> $LOG_FILE &
        ;;
    stop)
        echo "Stopping Tika server"
        pid=`ps aux | grep tika-server | awk '{print $2}'`
        kill -9 $pid
        ;;
    restart)
        $0 stop
        sleep 1
        $0 start
        ;;
    *)
        echo "Usage: $0 {start|stop|restart}" >&2
        exit 1
        ;;
esac


chmod +x /etc/inid.d/tika

chkconfig --add tika

service tika start


Thursday, September 4, 2014

Install TIKA and MAVEN

Install MAVEN

Unix-based Operating Systems (Linux, Solaris and Mac OS X)

  1. Extract the distribution archive, i.e. apache-maven-3.2.3-bin.tar.gz to the directory you wish to install Maven 3.2.3. These instructions assume you chose /usr/local/apache-maven. The subdirectory apache-maven-3.2.3 will be created from the archive.
  2. In a command terminal, add the M2_HOME environment variable, e.g. export M2_HOME=/usr/local/apache-maven/apache-maven-3.2.3.
  3. Add the M2 environment variable, e.g. export M2=$M2_HOME/bin.
  4. Optional: Add the MAVEN_OPTS environment variable to specify JVM properties, e.g. export MAVEN_OPTS="-Xms256m -Xmx512m". This environment variable can be used to supply extra options to Maven.
  5. Add M2 environment variable to your path, e.g. export PATH=$M2:$PATH.
  6. Make sure that JAVA_HOME is set to the location of your JDK, e.g. export JAVA_HOME=/usr/java/jdk1.7.0_51 and that $JAVA_HOME/bin is in your PATH environment variable.
  7. Run mvn --version to verify that it is correctly installed.
source: http://maven.apache.org/download.cgi



Install TIKA


wget http://mirror.vorboss.net/apache/tika/tika-x.x-src.zip
unzip tika-x.x-src
cd ./tika-x.x/
mvn install
cd ./tika-server/target/
java -jar tika-server-x.x.jar





source: http://wiki.apache.org/tika/TikaJAXRS