install Apache Solr | BIP media

Install Apache Solr 4.7 multicore Overview

I will show you how to install the Apache Solr search engine under Tomcat7servlet container on Ubuntu 12.04.4 LTS (Precise Pangolin) to be used later with Drupal 7. In this writeup I’m gonna discuss only the installation and setup of the ApacheSolr server. Specific Drupal configuration and/or Drupal side configuration to be discussed in future writeup.

Install Tomcat7

We’re installing Oracle Java 7 before installing Tomcat7:

$ sudo apt-get purge oracle-java6-installer
$ sudo apt-get install software-properties-common python-software-properties
$ sudo add-apt-repository ppa:webupd8team/java
$ sudo apt-get update
$ sudo apt-get install oracle-java7-installer

Then get Tomcat7:

$ sudo apt-get install tomcat7 tomcat7-admin

Install Solr 4.7 multicore

$ cd ~
$ curl http://www.eu.apache.org/dist/lucene/solr/4.7.0/solr-4.7.0.tgz > solr-4.7.0.tgz
$ tar xzvf solr-4.7.0.tgz
$ sudo mv solr-4.7.0 /usr/share/solr
$ cd /usr/share/solr/example
$ sudo cp webapps/solr.war multicore/solr.war
$ cd /usr/share
$ sudo cp -r solr/example/lib/ext/* tomcat7/lib/
$ sudo cp -r solr/example/resources/log4j.properties tomcat7/lib/

Configure Solr

Edit log4j.properties and set the solr.log setting:

$ sudo nano /usr/share/tomcat7/lib/log4j.properties

Set there solr.log=/usr/share/solr.

Now, let’s a get Solr into Tomcat Catalina config. Create a new solr.xml file:

$ sudo nano /etc/tomcat7/Catalina/localhost/solr.xml

and add

<Context docBase="/usr/share/solr/example/multicore/solr.war" debug="0" crossContext="true">
  <Environment name="solr/home" type="java.lang.String" value="/usr/share/solr/example/multicore" override="true" />
</Context>

Add Tomcat GUI administrative users:

$ sudo nano /etc/tomcat7/tomcat-users.xml

Add the tomcat user within the block:

<tomcat-users>
  <role rolename="manager-gui"/>
  <user username="admin" password="mysecretpassword" roles="manager-gui"/>
</tomcat-users>

Ensure correct permissions:

$ sudo chown -R tomcat7 /usr/share/solr/example/multicore

Restart Tomcat:

$ sudo service tomcat7 restart

Testing Solr

You are able now to access the Solr administrative interface at http://localhost:8080/solr.

Apache Solr services, corresponding to each configured core are delivered at:

  • http://localhost:8080/solr/core0
  • http://localhost:8080/solr/core1

Security

Place the next line inside <Context> in /etc/tomcat7/Catalina/localhost/solr.xml:

<Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="127.0.0.1|86.120.24.124" />

You’re done. Now it’s time to configure Solr and you application that use it. About that in another writeup.



Tags: , , , , , , ,

Spin up a cloud server in no time flat

Simple setup. Full root access. Straightforward pricing.


DEPLOY SERVER




Leave a Reply