By wattanmalik on
Solr Installation With Tomcat6 : -
- First Install Tomcat6 and apache solr on system.
- For tomcat installation use:
- apt-get install tomcat6
- after installation check tomcat server on localhost:8080
- Now download apache solr 3.6.2 from - http://apache.ziply.com/lucene/solr/ or
- wget http://apache.ziply.com/lucene/solr/apache-solr-3.6.2.tgz
- now extract apache solr folder: tar xzvf apache-solr-3.6.2.tgz
- Now create a solr folder out of www folder where all the solr cores and indexes will go.
- sudo mkdir -p /var/solr
- Now copy the solr webapp and the example multicore configuration files for multicore solr setup from solr download:
- sudo cp apache-solr-3.6.2/dist/apache-solr-3.6.2.war /var/solr/solr.war
- sudo cp -R apache-solr-3.6.2/example/multicore/* /var/solr/
- Now you have to copy conf folder from downloaded apache solr in each solr multicore (take backup of already existing conf folder in each core and copy this new conf folder there) :
- sudo cp -R apache-solr-3.6.2/example/solr/conf/ /var/solr/core0
- sudo cp -R apache-solr-3.6.2/example/solr/conf/ /var/solr/core1
- sudo chown -R tomcat6 /var/solr
- Now we need to point Catalina at Solr (Catalina located in /etc/tomcat6):
- Now type this command in Terminal:
echo -e '<Context docBase="/var/solr/solr.war" debug="0" privileged="true" allowLinking="true" crossContext="true">\n<Environment name="solr/home" type="java.lang.String" value="/var/solr" override="true" />\n</Context>' | sudo tee -a /etc/tomcat6/Catalina/localhost/solr.xmlecho 'TOMCAT6_SECURITY=no' | sudo tee -a /etc/default/tomcat6
- Now type this command in Terminal:
- Now type this command to set solr.home pointing it at /var/solr
- JAVA_OPTS="$JAVA_OPTS -Dsolr.home=/var/solr"
- Done with solr installation and now Restart Tomcat6:
- sudo /etc/init.d/tomcat6 restart
- Now check your solr:
- localhost:8080/solr/
- you have multicore apache solr server installed
Now For Apache Solr Server Configuration with Drupal6:
- For configuration of Drupal6 to solr Download Apache Solr Search Module for drupal6:
- http://drupal.org/project/apachesolr
- extract module and paste it in your drupal6 setup /sites/all/modules/
- Now Download PHPSolarClient module:
- http://code.google.com/p/solr-php-client/downloads/detail?name=SolrPhpClient.r22.2009-11-09.tgz
- Now extract PHPSolar Client module and paste it inside apachesolr module in your drupal6 setup : /sites/all/modules/apachesolr/
- Then copy schema.xml and solrconfig.xml from apachesolr module from your drupal6 setup to conf folder inside any core of Apache solr server which you want to configure with drupal, like (take backup of old schema.xml and solrconfig.xml):
- sudo cp /sites/all/modules/apachesolr/schema.xml /var/solr/core0/conf
- sudo cp /sites/all/modules/apachesolr/solrconfig.xml /var/solr/core0/conf
- sudo chown -R tomcat6 /var/solr/
- sudo service tomcat6 restart
- Now login to admin panel of your drupal6 project and then go to modules list:
- http://yourdomain/admin/build/modules/list
- enable Apache Solr Framework, Search, Apache Solr node access, Apache Solr search and other modules depends on Apache Solr Framework.
- Now go to link Administer->Site Configuration->Apache Solr or type in url : admin/settings/apachesolr
- Insert solr settings, refer below image and save configuration.
- solr host name : localhost or Host name of solr server like your domain name.
- solr port : 8080
- solr path : /solr/core0 (note: here you can add any core which is configured with drupal.)
- Finally Apache Solr Server configured with your drupal setup.
- Now After configuration no content is indexed in Apache Solr.
- For indexing all the content in Solr you have to run cron:
- Go to Administer->site configuration->Apache Solr click on Search Index tab.
- now click on cron for content indexing.
- For making Apache Solr search default:
- Go to Administer->site configuration->Apache Solr click on Settings tab.
- enable : Make Apache Solr Search the default
Comments
Bookmarked for later
Bookmarked for later references if people need help with Apache Solr.
Nice job. One question though, why did you choose 3.6.2 over 4.1.0? Just curious as to the reasoning as I am unaware of the differences.
All good except...
echo -e '\n\n' | sudo tee -a /etc/tomcat6/Catalina/localhost/solr.xml
Replace the above line with....
and it works!
Thanks sm8082
It is because of "
<code>" tag is missing for the code.Now corrected.
Thank you...!!
fantastic/helpful topic
Yes I realised that too when I pasted. Anyway I must say this is the best and absolutely to the point tutorial on how to install/configure Tomcat and Apache Solr.
Thanks
Thanks sm8082
Thanks Buddy..!!!
I'll +1 that! After several
I'll +1 that! After several frustrating attempts, this saved me. Excellent How-To.
Only thing I'll add is that if you're upgrading from 1.x to 3.x, make sure you first completely uninstall the old apachesolr module, and that all related db tables and variable records are gone (drush pm-uninstall). Otherwise, the updated 3.x module won't install properly. The readme states this explicitly.
Thanks again!