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
solr
user - Download Tomcat6
- Extract to
/opt/tomcat
, this will be the$CATALINA_HOME
directory, you can use any dir you want - Edit
/opt/tomcat/conf/tomcat-users.xml
to 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 tosolr
user (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.sh
files 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 tomcat6
and/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.war
to/opt/tomcat/webapps/solr.war
- Copy
/opt/apache-solr-1.4.1/example/solr
directory to/opt/tomcat/solr
this will be the$SOLR_HOME
directory, you can use any dir you want - Create file
/opt/tomcat/conf/Catalina/localhost/solr.xml
with 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.xml
to/opt/tomcat/solr/conf/schema.xml
- Copy
/var/www/site1/sites/all/modules/apachesolr/solrconfig.xml
to/opt/tomcat/solr/conf/solrconfig.xml
- Copy
/opt/apache-solr-1.4.1/example/multicore/solr.xml
to/opt/tomcat/solr/solr.xml
- Create directory for each site and copy
/opt/tomcat/solr/conf
directory to each of them. Example:
1 2 3 4 |
|
- Edit
/opt/tomcat/solr/solr.xml
with 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.