Update 2/11/14: I’ve created https://github.com/13rac1/install-apache-solr an install.sh 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 http://www.apache.org/dyn/closer.cgi/lucene/solr/ 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" />
    </Context>
    
  13. Change the Tomcat server port from the default 8080 to 8983 (or any other port of your choice)

  14. <em>pico /etc/tomcat6/server.xml</em>
    

    and change:

    <Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               URIEncoding="UTF-8"
               redirectPort="8443" />
    

    To:

    <Connector port="8983" protocol="HTTP/1.1"
               connectionTimeout="20000"
               URIEncoding="UTF-8"
               redirectPort="8443" />
    
  15. Download the Apachesolr (or Search API Solr search) from Drupal.org: wget http://ftp.drupal.org/files/projects/apachesolr-7.x-1.x-dev.tar.gz

  16. Uncompress the archive: tar zxf apachesolr-7.x-1.x-dev.tar.gz

  17. Replace the Solr XML config files with the Drupal specific versions:

    cp apachesolr/solr-conf/protwords.txt /var/solr/TEMPLATE/conf/protwords.txt
    cp apachesolr/solr-conf/schema-solr3x.xml /var/solr/TEMPLATE/conf/schema.xml
    cp apachesolr/solr-conf/solrconfig-solr3x.xml /var/solr/TEMPLATE/conf/solrconfig.xml
    
  18. /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.

Comments

(Statically copied from previous site)

Nestor replied on September 2, 2016 - 9:36am

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?

Thanks

(Brad: It’s interesting thinking back about where I was and why I didn’t reply to this comment posted four years ago and four years after the OP.)