Getting Apache Solr installed.

Steps to install.

  1. Decide what module to use: Search API Solr Search or Search API Solr The Search API Solr module is ported to Drupal 8 so I decided on using it.
  2. Install Java.  I opted to install java-8-oracle following this page. http://www.webupd8.org/2012/09/install-oracle-java-8-in-ubuntu-via-ppa.html
  3. Find the right version of Solr.  The latest solr is version 6.x.x (http://lucene.apache.org/solr/) which is not supported by Search API Solr.  For drupal 7 maximum support Solr version is Solr 5.4.1. Solr 5 is now a stand-alone service and it's no longer necessary to run it in a container like Tomcat. I followed this page  https://www.triquanta.nl/blog/solr-5-first-look which gives a pretty good recipe for installing Solr. Solr is installed in /opt/solr and the data are stored in /var/solr.  However I was confused by how to create the cores or configuration files.  I used the ones provided by Search API Solr module and the following instructions on Installing Solr 5.x
  4. Core or configuration files: Below are modified instructions (in bold) for my setup where the solr installation is in /opt/solr and the data are in /var/solr
  5. The solr 5.x configuration files are located in the sites/all/modules/search_api_solr/solr-conf/5.x directory. Create a new folder structure in your Solr data directory with the path /var/solr/data/drupal/conf and copy all configuration files there. After coping you need to: sudo chown -R solr:solr /var/solr  to change the owner to solr.
  6. Open localhost:8983 in a web browser to bring up the solr admin.  Create a new core call drupal with an instancedir of drupal/conf (Note in ubunut 16.04 install I could only get it to work by leaving the instacedir blank0
  7. On the Drupal site  go to admin/config/search/search_api and add a new server called Solr using the service of Apache Solr Search Server with the Solr path of /solr/drupal
  8. Change the Data Set Index provided by DEIMS to use the new Solr server.  Index Now will index the site right away.
  9. The Power search is now very fast and wild cards can be used.

Note to restrict access to Solr by IP addresses I followed this  (https://duntuk.com/how-install-apache-solr-5x-use-drupal)

Add your server IP and YOUR IP to the Solr server whitelist

vi /opt/solr/server/etc/jetty.xml

Search for:

<New id="Contexts" class="org.eclipse.jetty.server.handler.ContextHandlerCollection"/>

Replace with:

<!-- Solr IP whitelist  -->
<New class="org.eclipse.jetty.server.handler.IPAccessHandler">
  <Call name="addWhite">
    <Arg>127.0.0.1</Arg>
  </Call>
  <Call name="addWhite">
    <Arg>YOUR.IP.ADDRESS.HERE</Arg>
  </Call>
  <Set name="handler">
    <New id="Contexts" class="org.eclipse.jetty.server.handler.ContextHandlerCollection"/>
  </Set>
</New>
<!-- / Solr IP whitelist  -->

Start Solr server

systemctl start solr.service
or
service solr start

  Jim L