Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!

Author Topic: How to install and configure Solr for Magento and CentOS  (Read 3737 times)

0 Members and 1 Guest are viewing this topic.

vinayakk

  • Guest
How to install and configure Solr for Magento and CentOS
« on: February 08, 2014, 06:42:39 am »
Solr (pronounced "solar") is an open source enterprise search platform from the Apache Lucene project. Its major features include full-text search, hit highlighting, faceted search, dynamic clustering, database integration, and rich document (e.g., Word, PDF) handling. Providing distributed search and index replication, Solr is highly scalable.

Solr is written in Java and runs as a standalone full-text search server within a servlet container such as Apache Tomcat or Jetty. Solr uses the Lucene Java search library at its core for full-text indexing and search, and has REST-like HTTP/XML and JSON APIs that make it usable from most popular programming languages. Solr's powerful external configuration allows it to be tailored to many types of application without Java coding, and it has a plugin architecture to support more advanced customization.

For installing solr, you need java.

Download the Java JRE package from http://java.com/en/download/manual.jsp.

Since we are using centos, download the rpm and issue the following commands.

Code: [Select]
# mv jre-6u30-linux-x64-rpm.bin /usr/java
# chmod a+x jre-6u30-linux-x64-rpm.bin
# ./jre-6u30-linux-x64-rpm.bin

This will install Java into a subdirectory of the directory in which the package is located (in this case, /usr/java), and adds the executable to /usr/bin/.

Next, download the Solr code http://apache.dattatec.com//lucene/solr/ and do the following steps.

Code: [Select]
# cd /usr/src
# wget http://apache.dattatec.com//lucene/solr/3.6.1/apache-solr-3.6.1-src.tgz
# tar -xvzf apache-solr-3.6.1-src.tgz
# mkdir /etc/apache-solr-3.6.1
# cp -rp apache-solr-3.6.1/* /etc/apache-solr-3.6.1/

At this point, you can start Solr (running in the foreground) by issuing the commands:

Code: [Select]
# cd /etc/apache-solr-3.6.1/example
# java -jar start.jar

You need to run this process in a screen. So not stop this one.

This will start the Solr server listening on the default port 8983. You may need to open the port in firewall.

Type  this command

Code: [Select]
# curl -sI http://localhost:8983/solr/

and you will get the result.

HTTP/1.1 200 OK
Content-Type: text/html
Expires: Thu, 01-Jan-1970 00:00:00 GMT
Set-Cookie: JSESSIONID=158w7ap77e7yt1crzzjawm2y5q;Path=/solr
Content-Length: 0

You can also try the url “hostnameip/solr”

Finally, to prepare the Solr server for use by Magento. You need to copy the contents from the mgjento folder to the solr folder.

Code: [Select]
# cp -R home/username/public_html/lib/Apache/Solr/conf /etc/apache-solr/example/solr/
To point your Magento installation to your Solr server, simply open your admin panel, navigate to the search configuration (System->configuration, catalog), select Solr from the search engine drop-down menu, and enter in the server details. The account and password fields can both be left blank, by default.

 :)