Here’s my quick install guide for Solr, Tomcat, and Drupal ApacheSolr module for multiple sites. Mostly I based the steps below from the following sites: wiki.apache.org and drupalconnect.com.
Detailed Setup:
- Drupal 6.19
- ApacheSolr module 6-1.1
- Apache Solr PHP Client Library: Rev.22
- Solr 1.4.1
- Tomcat 6.0.29
- SunJDK 6update21
- RHEL5.5x64
Install Process: Tomcat
- Create
solruser - Download Tomcat6
- Extract to
/opt/tomcat, this will be the$CATALINA_HOMEdirectory, you can use any dir you want - Edit
/opt/tomcat/conf/tomcat-users.xmlto enable Tomcat login. See comments in this file.
1 2 3 | |
- Test run your Tomcat:
/opt/tomcat/bin/catalina.sh run. Chown all Tomcat files tosolruser (chown -R solr.solr /opt/tomcat). Default server setting will use port 8080, to customized edit the file/opt/tomcat/conf/server.xml. If you encounter error on ”BASEDIR environment variable is not defined correctly…”, check permissions of.shfiles inside/opt/tomcat/bin/and make them executable (chmod 755 /opt/tomcat/bin/*.sh). - Add startup (init) script. Copy this Tomcat6 init file from Apache.org to /etc/init.d/tomcat6. Check and update variables like Java home, Tomcat directory, etc, if needed. Add to startup
/sbin/chkconfig --add tomcat6and/sbin/chkconfig tomcat6 on. Dependencies: redhat-lsb (or lsb-base?) - Visit your Tomcat Admin page. ex http://localhost:8080
Install Process: Solr
- Download Solr
- Extract to temporary location, ex:
/opt/apache-solr-1.4.1 - Copy
/opt/apache-solr-1.4.1/dist/apache-solr-1.4.1.warto/opt/tomcat/webapps/solr.war - Copy
/opt/apache-solr-1.4.1/example/solrdirectory to/opt/tomcat/solrthis will be the$SOLR_HOMEdirectory, you can use any dir you want - Create file
/opt/tomcat/conf/Catalina/localhost/solr.xmlwith the following configuration. Make sure paths are correct.
1 2 3 | |
Install Process: ApacheSolr Drupal module and SolrPHP client
- Install/enable Drupal ApacheSolr module. Drush, CVS, or traditional install - whatever you want. Example:
/var/www/site1/sites/all/modules/apachesolr - Download SolrPHP client library
Configure Solr for Multi-Core Setup
- Copy
/var/www/site1/sites/all/modules/apachesolr/schema.xmlto/opt/tomcat/solr/conf/schema.xml - Copy
/var/www/site1/sites/all/modules/apachesolr/solrconfig.xmlto/opt/tomcat/solr/conf/solrconfig.xml - Copy
/opt/apache-solr-1.4.1/example/multicore/solr.xmlto/opt/tomcat/solr/solr.xml - Create directory for each site and copy
/opt/tomcat/solr/confdirectory to each of them. Example:
1 2 3 4 | |
- Edit
/opt/tomcat/solr/solr.xmlwith the following config:
1 2 3 4 5 6 7 | |
- Start or Restart Tomcat:
/etc/init.d/tomcat6 start - Visit
http://localhost:8080/and go to you Solr App
Configure Drupal site:
- Go to ApacheSolr settings
http://localhost/admin/settings/apachesolr - Save your config and if all is good you’ll see message:
Your site has contacted the Apache Solr server.
1 2 3 | |
- Configure your search index.