Extension:SolrStore/Install Solr

From MediaWiki.org
Jump to: navigation, search

Install Apache Solr under Ubuntu[edit | edit source]

This Tutorial describes how to install a local Tomcat Server with the newest Solr Version.

Install Java Runtime Environment[edit | edit source]

At First we need a Java Runtime Environment. You can use OpenJdk or Oracle (Sun) Java Version 6+

       aptitude install default-jre

or

       apt-get install openjdk-6-jdk

Tomcat downloading and install[edit | edit source]

At Firts we need the newest Tomcat Version from Apache.org. If this link isn't working anymore go to tomcat.apache.org

       cd /opt
       wget http://artfiles.org/apache.org/tomcat/tomcat-7/v7.0.30/bin/apache-tomcat-7.0.30.tar.gz
       tar xvfz apache-tomcat-7.0.30.tar.gz
       ln -s apache-tomcat-7.0.30 tomcat
       rm apache-tomcat-7.0.30.tar.gz

Solr downloading and install[edit | edit source]

Now we need the Newest Version of Solr. You can find it on the Apache Site (http://www.apache.org/dyn/closer.cgi/lucene/solr/)

       cd /opt
       wget http://apache.imsam.info/lucene/solr/3.6.2/apache-solr-3.6.2.tgz
       tar xvfz apache-solr-3.6.2.tgz
       rm apache-solr-3.6.2.tgz

Now we deploy Apache Solr to the Tomcat Server. Copy the war File from the "dist" dir to your Tomcat webapps folder.

       cd /opt
       cp apache-solr-3.6.2/dist/apache-solr-3.6.2.war tomcat/webapps/solr.war

Now copy the Multicore Example to your Solr Folder /opt/solr. Now you can delete the other solr files, we dont need them.

       cd /opt
       cp -R apache-solr-3.6.2/example/multicore/ solr
       rm -R apache-solr-3.6.2

Now we can start your new Tomcat server.

Note: It's important to strat the Tomcat Server from /opt, otherwise the Tomcat Server will not find your solr dir.

       cd /opt
       ./tomcat/bin/startup.sh

Now you can see your solr Cores and the admin interface under the url http://yourserver:8080/solr

Your Solr Server is now ready to use, but you should maybe add some security configuration

Secure your Installation[edit | edit source]

Your have just to do a few steps to scure your server.

Move your Data:

Create a new dir and change it in your Solr config. If you use 2 cores you have to change it for eache of them:

       mkdir /var/solr
       vi /opt/solr/solr.xml

before :

       <core name="core-0" instanceDir="core-0" />
       <core name="core-1" instanceDir="core-1" />

after:

       <core name="core-0" instanceDir="core-0" dataDir="/var/solr/core-0" />
       <core name="core-1" instanceDir="core-1" dataDir="/var/solr/core-1" />

Tomcat logging.properties:[edit | edit source]

Your Logging Properties should be reduced to SEVERE, otherwise it will be realy big realy fast.

Edit the logging.properties File in /opt/tomcat/conf

       vi /opt/tomcat/conf/logging.properties

Default is "FINE". You should change it from "FINE" to "SEVERE"

Install Apache Solr under Windows[edit | edit source]

  1. Extract Apache Solr, then go to the /dist folder. Copy the war file (.war) to the folder C:\xampp\tomcat\webapps and rename it to solr.war.
  2. Create an index folder C:\xampp\solr.
  3. Copy the content of the folder /solr-example/ (from Extension:SolrStore) into the index folder.
    1. Edit solr.xml (in the index folder) and change /var/solr/core0 to C:/xampp/solr/core0.
  4. Java settings of -Dsolr.solr.home=c:/xampp/solr should be added to your C:\xampp\tomcat\bin\catalina.bat (xampp 1.7.7) file (search for %JAVA_OPTS% %CATALINA_OPTS% %JPDA_OPTS%).

Depending on the LocalSettings ( e.g. $wgSolrUrl = 'http://localhost:8080/solr/core0';) the Solr admin interface should be available at (e.g. http://localhost:8080/solr/core0/admin/) together with its index files ( e.g. C:\xampp\solr\core0\var\solr\core0\index ).

Other important files (schema.xml etc.) can be found at ( e.g. C:\xampp\solr\core0\conf ).

More information on installing Solr on Windows can be found in this blog post.