Friday, February 21, 2014

Apache Solr 4.6.1 Tomcat7 Setup on Ubuntu 12.04 ( Simple and Clear Steps )

We need a tomcat server to install and run Apache solr search engine .

Setup Java run time environment by following blog post 


Install Tomcat 7 and Solr 4.6

sudo apt-get install tomcat7 tomcat7-admin


tar zxvf solr-4.6.1.tgz

sudo mv solr-4.6.1 /usr/share/solr

Setup Solr on Tomcat


sudo cp /usr/share/solr/example/webapps/solr.war /usr/share/solr/example/multicore/solr.war 

From the Apache Solr lib, copy all the jar files to the tomcat lib

sudo cp -r solr/example/lib/ext/* /usr/share/tomcat7/lib

sudo cp -r solr/example/resources/log4j.properties /usr/share/tomcat7/lib

Edit /usr/share/tomcat7/lib/log4j.properties and set your log path by setting

solr.log=/usr/share/solr

Now add solr to the Catalina config


cd /etc/tomcat7/Catalina/localhost
sudo gedit solr.xml

add the following to solr.xml

<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>

Setup Tomcat Manager

sudo gedit /etc/tomcat7/tomcat-users.xml

add the tomcat user within the users block:

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

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

Test tomcat

sudo service tomcat7 restart

Test Solr


Note : If you get any problem while restarting tomcat   " no JDK found - please set JAVA_HOME "
follow this step 

sudo gedit /etc/default/tomcat7  

uncomment JAVA_HOME path . 





3 comments:

  1. You'll need this ....
    https://stackoverflow.com/questions/23503116/cant-get-solr-4-8-working-with-tomcat-7-and-ubuntu-12-04/23513386#23513386

    ReplyDelete
  2. I found your post in searching for Apache Solr 4.6.1 Tomcat7 Setup on Ubuntu 12.04 for my Apache tomcat course and your simple and useful steps helps me to accomplish this task.thank you.

    ReplyDelete