Multi-instance Solr 3.6 for Drupal 7 on Ubuntu 12.04

Update 2/11/14: I've created an for Solr 4.6.x on Debian/Ubuntu. I suggest you use it.

There are probably enough posts the Internet covering Apache Solr installation, but here is multi-instance (not-core) Apache Solr 3.6.x with Tomcat6 for Drupal 7 on Ubuntu 12.04 LTS. Perhaps it'll be useful for you. This setup is used on a development server to host search indexes for many development sites.

  1. Goto and find an Apache Solr mirror.
  2. wget http://$MIRROR/apache/lucene/solr/3.6.2/apache-solr-3.6.2.tgz
  3. tar zxf apache-solr-3.6.2.tgz
  4. /etc/init.d/tomcat6 stop
  5. cp apache-solr-3.6.2/dist/apache-solr-3.6.2.war /var/lib/tomcat6/webapps/solr.war
  6. /etc/init.d/tomcat6 start (This creates the /var/lib/tomcat6/webapps/solr directory)
  7. /etc/init.d/tomcat6 stop
  8. cp -aR /var/lib/tomcat6/webapps/solr /var/lib/tomcat6/webapps/TEMPLATE
  9. mkdir -p /var/solr/TEMPLATE
  10. cp -aR apache-solr-3.6.2/example/solr/* /var/solr/TEMPLATE
  11. pico /etc/tomcat6/Catalina/localhost/TEMPLATE.xml (use vim/vi if you want!)
  12. Paste in the following and save (Save CTRL-X then enter):
        <Context docBase="/var/lib/tomcat6/webapps/solr.war" debug="0" crossContext="true" >
          <Environment name="solr/home" type="java.lang.String" value="/var/solr/TEMPLATE" override="true" />
  13. Change the Tomcat server port from the default 8080 to 8983(or any other port of your choice)
    pico /etc/tomcat6/server.xml and change:

        <Connector port="8080" protocol="HTTP/1.1"
                   redirectPort="8443" />


        <Connector port="8983" protocol="HTTP/1.1"
                   redirectPort="8443" />
  14. Download the Apachesolr (or Search API Solr search) from
  15. Uncompress the archive: tar zxf apachesolr-7.x-1.x-dev.tar.gz
  16. Replace the Solr XML config files with the Drupal specific versions:cp apachesolr/solr-conf/protwords.txt /var/solr/TEMPLATE/conf/protwords.txtcp apachesolr/solr-conf/schema-solr3x.xml /var/solr/TEMPLATE/conf/schema.xmlcp apachesolr/solr-conf/solrconfig-solr3x.xml /var/solr/TEMPLATE/conf/solrconfig.xml
  17. /etc/init.d/tomcat6 start

To use: copy the TEMPLATE files/directories to match the name of the new project, then restart Tomcat.

    cp -ar /var/solr/TEMPLATE /var/solr/$PROJECT
    chown tomcat6:root -R /var/solr/$PROJECT
    cp -a /etc/tomcat6/Catalina/localhost/TEMPLATE.xml /etc/tomcat6/Catalina/localhost/$PROJECT.xml
    sed -i "s/TEMPLATE/$PROJECT/" /etc/tomcat6/Catalina/localhost/$PROJECT.xml
    cp -ar /var/lib/tomcat6/webapps/TEMPLATE /var/lib/tomcat6/webapps/$PROJECT
    /etc/init.d/tomcat6 restart

Update 7/15/2013: Change 3.6.1 to 3.6.2.


Nice!!!! Thanks it makes it easier to create a multicore both looking at
a drupal6 site.

How would go about setting up the second core to index a separate web site in the same server?