Apache Solr Setup for Magento
Initial Configuration
Using a blank Debian 6 with SSH enabled, connect and run:
apt-get install unzip locate
Setup base apps
# get the base apt-get install tomcat6 tomcat6-admin # create an admin user nano /etc/tomcat6/tomcat-users.xml # Add the following user: <?xml version='1.0' encoding='utf-8'?> <tomcat-users> <role rolename="manager"/> <role rolename="admin"/> <user username="admin" password="pass123" roles="admin,manager"/> </tomcat-users> # restart the service /etc/init.d/tomcat6 restart ### NOTE ON PORT # You may need to edit /etc/tomcat6/server.xml [line 71] set to 8181 # view the server http://192.168.1.35:8080 http://192.168.1.35:8080/manager/ ---------------------------- wget http://apache.cict.fr/lucene/solr/3.6.0/apache-solr-3.6.0.zip unzip apache-solr-3.6.0.zip cd apache-solr-3.6.0/ # copy the main app to the "webapps" folder cp dist/apache-solr-3.6.0.war /var/lib/tomcat6/webapps/solr.war # this also creates a "solr" directory here within 60s: # /var/lib/tomcat6/webapps/solr cp -rf example/solr/* /var/lib/tomcat6/webapps/solr/ chown -R tomcat6:tomcat6 /var/lib/tomcat6/webapps/solr # stop tomcat /etc/init.d/tomcat6 stop # create our config file touch /etc/tomcat6/Catalina/localhost/solr.xml chown tomcat6:tomcat6 /etc/tomcat6/Catalina/localhost/solr.xml nano /etc/tomcat6/Catalina/localhost/solr.xml # and fill it with the following configuration : <Context docBase="/var/lib/tomcat6/webapps/solr.war" debug="0" privileged="true" allowLinking="true" crossContext="true"> <Environment name="solr/home" type="java.lang.String" value="/var/lib/tomcat6/solr" override="true" /> </Context> # edit the data path mkdir -p /var/lib/solr/data chown -R tomcat6:tomcat6 /var/lib/solr/data nano /var/lib/tomcat6/webapps/solr/conf/solrconfig.xml # edit the path <dataDir>/var/lib/solr/data</dataDir> # start tomcat /etc/init.d/tomcat6 start # this link should now work: http://192.168.1.35:8080/solr/admin/ ---------------------------- # Disable excessive double logging to .out file ---------------------------- # MULTI-core setup ---------------------------- # stop tomcat /etc/init.d/tomcat6 stop # edit the config file: nano /var/lib/tomcat6/webapps/solr/solr.xml # add the following replacing the existing data <cores adminPath="/admin/cores" defaultCoreName="core0"> <core name="core0" instanceDir="core0" /> <core name="core1" instanceDir="core1" /> </cores> # create default directories mkdir core0 core1 #copy or create the magento conf folder in each cp -R /root/magesolrtemp/conf /var/lib/tomcat6/webapps/solr/core0/ cp -R /root/magesolrtemp/conf /var/lib/tomcat6/webapps/solr/core1/ # start tomcat /etc/init.d/tomcat6 start # this link should now work: http://192.168.1.35:8080/solr/admin/ ---------------------------- # MAGENTO: cd /home/magentosite/public_html/shell php ./indexer.php --reindex catalogsearch_fulltext
Primary sites to look at for information:
http://stackoverflow.com/questions/7168249/how-to-configure-magento-enterpise-to-use-solr-as-the-main-search-engineOther sites to look at for information:
http://lucene.apache.org/solr/
http://wiki.apache.org/solr/SolrTomcat
http://pabloseminario.com/2011/02/22/installing-solr-on-debian-6-0/
http://www.summasolutions.net/blogposts/magento-apache-solr-integration
http://www.summasolutions.net/blogposts/magento-apache-solr-set
http://www.summasolutions.net/blogposts/magento-apache-solr-integration-part-iii-indexing-custom-data
http://www.summasolutions.net/blogposts/magento-apache-solr-integration-part-iv-ajax-search-form