Tuesday, Jul 31st, 2012
Update 2/11/14: I've created https://github.com/eosrei/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.
- Goto http://www.apache.org/dyn/closer.cgi/lucene/solr/ and find an Apache Solr mirror.
- wget http://$MIRROR/apache/lucene/solr/3.6.2/apache-solr-3.6.2.tgz
- tar zxf apache-solr-3.6.2.tgz
- /etc/init.d/tomcat6 stop
- cp apache-solr-3.6.2/dist/apache-solr-3.6.2.war /var/lib/tomcat6/webapps/solr.war
- /etc/init.d/tomcat6 start (This creates the /var/lib/tomcat6/webapps/solr directory)
- /etc/init.d/tomcat6 stop
- cp -aR /var/lib/tomcat6/webapps/solr /var/lib/tomcat6/webapps/TEMPLATE
- mkdir -p /var/solr/TEMPLATE
- cp -aR apache-solr-3.6.2/example/solr/* /var/solr/TEMPLATE
- pico /etc/tomcat6/Catalina/localhost/TEMPLATE.xml (use vim/vi if you want!)
- 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>
- 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" connectionTimeout="20000" URIEncoding="UTF-8" redirectPort="8443" />
To:
<Connector port="8983" protocol="HTTP/1.1" connectionTimeout="20000" URIEncoding="UTF-8" redirectPort="8443" />
- 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 - Uncompress the archive: tar zxf apachesolr-7.x-1.x-dev.tar.gz
- 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
- /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
Nestor replied on Permalink
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,