Setting up Apache Solr 5 on Centos for use with Drupal

As of this writing, the latest version of Solr is 5.3.0. I used this version but I assume that will work on any version 5.x and up. In this step by step guide we will install that version and integrate it with Drupal 7  using Search API module.

All we need to do is to configure the pre-setup Search API Solr server and index. The good thing about using Search API is that it is already integrated with Views module and we can do unlimited customization with our search results.

The Solr version 5.x is now a stand alone server (thank God), it already comes with Java web server. If we look at Solr version 4.x and below, they need to install Tomcat or Jetty in order to run as a server. Our installation in version 5.x is by far much easier.


Install Java

First things first. We need Java. Solr is a Java application and in order to run it we need to install Java in our system.

First we check out if Java is already installed in our machine by issuing the following command:
which java

If Java is not installed, check the available versions of Java and install it:

yum list available java*
yum install java-1.8.0-openjdk.x86_64

Then verify if it is already installed:

which java
java -version


You should now have Java 8 installed and see something like that:



Seup Solr server

Solr require system user named “solr” and we will create one:


Download and setup Solr server:


Make the Solr server auto-run when the machine reboot or shutdown:


Create Solr core:

Solr core is a running Lucene index instance with the Solr configuration. It is ideal to create one for each Drupal site (if  you are running multi-site).


Create Solr core instance named “nixpal” (or whatever you like just remember the name):


I assume you did that with root, so you need to change ownership again just in case.

If you get this error:

“Failed to create core ‘nixpal’ due to: Error CREATEing SolrCore ‘nixpal’: Unable to create core [nixpal] Caused by: /var/solr/data/nixpal/data”

Issue this command again:

And of course change ownership again.



Installing schema file and solrconfig file from Drupal.

Download search_api_solr module, untar and copy the Drupal specific Solr 5.x core configurations to overwrite the existing configuration files in the created core instance:

I use version 1.9. Check for newer version of course if you can.


I’ve search hours for that. Anyway, in case you need ONLY the files (schema.xml / solrconfig.xml, extra settings, etc) you can find them also here ( ) for ALL Solr versions (3/4/5). Handy to have that link around.



Add your server’s IP address to whitelist as well as your personal computer’s network IP address (in able to access the Solr admin web interface

Wrap the item ‘<New id=”Contexts” class=”org.eclipse.jetty.server.handler.ContextHandlerCollection”/>’ with an IPAccessHandler:

search and replace the ‘<New id=”Contexts” class=”org.eclipse.jetty.server.handler.ContextHandlerCollection”/>’ with these lines:



Finally it should be something like this (parsing a few extra lines from top and bottom)


Now you can start your server:




(because I hate the systemd way)


You got Apache SOLR installed and running with a core named nixpal.

So your URL should be something like:

Happy searching / indexing !


2 thoughts on “Setting up Apache Solr 5 on Centos for use with Drupal”

    1. Typo sorry. I was playing with 5.2 before. Then Drupal released an update for 5.3 so I used the latest version when writing it.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.