Search

Tuesday 27 March 2012

Install SOLR 3.5 on Centos

Install Centos 32 or 64 bit on the relevant hardware or VM accepting all default installation options

Install Tomcat 6.x from the Centos package manager

Modify startup items to make sure Tomcat 6 runs at boot time. Please note startup items are user specific, so if logged in as administrator, root would not have Tomcat startup automatically

Reboot the server

Test if Tomcat is working by opening Firefox and navigating to http://localhost:8080/manager/html

Download the TGZ binary (non src) version of SOLR 3.5 from http://www.mirrorservice.org/sites/ftp.apache.org//lucene/solr/3.5.0/

Decompress file to /OPT/SOLRBINARY (you will need to create this folder)

Copy the whole SOLR folder from /OPT/SOLRBINARY/apache-solr-3.5.0/example/  to /OPT/
Running as root, open a terminal and run the following - CHMOD 777 –R /OPT
Copy the Tomcat SOLR webapp (the .WAR file) from /OPT/SOLRBINARY/apache-solr-3.5.0/dist to /OPT/SOLR/ and rename it to solr.war

Now copy this solr.war file to /USR/SHARE/TOMCAT6/WEBAPPS
From the command line terminal run (as root): service tomcat6 restart
Now, to fix library bugs copy the following from /OPT/SOLRBINARY/apache-solr-3.5.0/contrib./extraction/lib: (where x is version number)

Tika-core-x.jar
Xmlbeans-x.jar
Xml-apis-x.jar
Xercesimpl-x.jar

Copy to /USR/SHARE/TOMCAT6/WEBAPPS/SOLR/WEB-INF/LIB

From the command line terminal run (as root): service tomcat6 restart
Set the solr/home value in the /USR/SHARE/TOMCAT6/WEBAPPS/SOLR/WEB-INF/web.xml file by editing and un-commenting the following and changing the paths to those shown below:

   solr/home
   /OPT/SOLR
   java.lang.String

There is a bug in the 3.5.x velocity writer module and to fix this edit OPT/SOLR/CONF/SOLRCONFIG.XML and comment out line 1554 (which starts ‘Query Response Writer Velocity’)

Copy your custom schema.xml file to /OPT/SOLR/CONF/SCHEMA.XML (if you have one)
From the command line terminal run (as root): service tomcat6 restart
Reboot the server
Test if Solr is running by going to: http://localhost:8080/solr/admin
Copy or create a PDF file locally on the SOLR server and place it in /OPT/SOLR (make sure the PDF is a ‘text’ PDF containing searchable strings
Open a terminal and navigate to /OPT/SOLR

Test an indexing of a file by using curl to upload the PDF file:
curl “http://localhost:8080/solr/update/extract?literal.id=smoketest&commit=true –F “myfile=@testpdf.pdf”
Navigate back to http://localhost:8080/solr/admin and in the ‘Query String’ box enter:
id:smoketest

Then press ‘search’
An XML results page should be displayed with your PDF file as the search result