How to Install Apache Solr on Windows XP

By John Kim | April 22nd, 2010    Retweet  



Apache Solr is an extremely powerful, enterprise level search engine, and can be used to store billions of records. For anyone with experience in MySql, you will understand how query time starts to degrade after reaching around 1,000,000 rows for any given table. After doing tons of research to try to find an alternative method for a quick and reliable search database, I stumbled upon the Apache Solr Project. The general consensus about Apache Solr is that it’s lightning fast, and after using it for a recent project I will definitely agree to this.

So this should be great news for a web developer who is looking for such a solution. Just go to the Apache Solr website, download and install the software, and you’re set right? Wrong! To give you a fair warning, the integration of Apache Solr onto your web server is a complete project in itself. The reason it’s so difficult is because of the lack of quality information online, so I’d like to share my knowledge to all you Apache Solr Noobs so you don’t have to rip your hair out your skull. If I can save just one hair follicle from this guide, then I’ve done my job. For women with mustaches, you may not want to continue reading as you may want to lose some facial hair.




The Downloads

Before I get started, I should let everyone know that this guide is mainly for Windows XP users, although there is a slight variation to the steps for anyone using the new Windows 7.

1. Download Xampp For Windows, Basic Package. http://www.apachefriends.org/en/xampp-windows.html

2. Download Tomcat Add-on. Tomcat is a java server and because Solr is run on Java getting Tomcat is necessary.

3. Download Java JDK http://java.sun.com/javase/downloads/index.jsp

4. Download Apache Solr from one of the mirrors. I got version 1.4.0 but I believe any version will do. http://www.proxytracker.com/apache/lucene/solr/

5. Download the Solr PHP Client. http://code.google.com/p/solr-php-client/




The Installation

1. Install Xampp, and follow the instructions.

2. Install Tomcat, and follow the instructions.

3. Install the latest java JDk.

4. There should now be a folder called /xampp in your C Drive. Enter the xampp folder and find the ‘xampp-control’ application, and start it.



5. Place a check mark for the Svc for Apache, MySQL, and Tomcat. This is so you install these applications as windows services.



6. Click the ‘SCM’ button and you should get a Windows Service Window.



7. Find the Apache Tomcat Service, then Right click it and go to ‘Properties’. Here you will set the Startup Type to Automatic, and close the properties window. We want Tomcat to start every time Windows boots up.




8. Now highlight Apache Tomcat in the Services Window, and click the option to Stop the Service if it’s not already Stopped. Tomcat has to be disabled for the next few steps.



9. Extract Apache Solr, then go into the /dist folder. There should be a file called apache-solr-1.4.0.war, copy this file.



10. Now find a folder in C:/xampp/tomcat/webapps/ and copy the apache-solr-1.4.0.war file into this folder. Rename apache-solr-1.4.0.war to solr.war.



11. Go back to the extracted Apache Solr folder and go to /example/solr/ then copy these files.



12. Create a New directory in C:/xampp/ called /solr/. You will now paste the /example/solr/ files into this directory.



13. Now find C:/xampp/tomcat/bin/tomcat6w, click on the Java Tab, and copy the command “-Dsolr.solr.home=C:xamppsolr” into the Java Options section.



14. Now go back to the Windows Services Window, and start Apache Tomcat.

15. Open up a browser and type “http://localhost:8080/solr/admin/” into the browser to confirm a successful installation of Apache Solr. You should see the Apache Solr Administrative Screen, if you see a bunch of error codes then you messed up. You might want to consider uninstalling everything, then start over and follow directions more carefully next time.






Conclusion

With Apach Solr successfully installed, you can now use the script language of your choice to interface with Apache Solr. I prefer to use PHP, which is why I instructed you to download the Solr-PHP-Client. Here is a good tutorial that will help you use the php-solr-client. I hope this guide will help you on your journey and self exploration of Apache Solr. Adding Apache Solr to your list of web development toolkits is what will separate you from the millions of right brained village idiots who claim to be web developers. If you still have questions then please feel free to leave a comment, or just leave some feedback so I don’t feel as if I’m writing to no one. It gets awfully lonely in the blogosphere.

digg it reddit stumble it facebook
Post to MySpace!
Add this to your blog:
(Copy & paste code)

10 Responses to “How to Install Apache Solr on Windows XP”

  1. prabu Says:

    I have a question about , how to code to search a results from mysql database from PHPusing solr search? and what are the steps to index data into solr before insert into mysql database in PHP.

  2. admin Says:

    It’s been a while, but I used the php solr client, and that interfaced php with solr. I believe the site where you download the php solr client provides some simple examples of how to insert data, and retrieve the info.

  3. prabu Says:

    Thanks admin, I got it some idea about how to index.
    Do you know about 1. how can define synonym terms in the search using the database? 2. Can SOLR build its index without an XML export in PHP client code?

  4. prabhu Says:

    thanks admin, Its working fine without database accessing. Is it possible to search using synonym in SOLR. ie. if i go to search for “money” now the solr bring results for money details , but “money” is having other synonym words like “currency” or “cost”. now my search query is “cost”, I am expecting results as money details but SOLR is not bring the result. Wat i have to do? any suggestion or idea ?

  5. admin Says:

    I never really delved too deep into using Solr, I just did some simple indexing to take advantage of it’s fast retrieval. I’m thinking I’ll need to buy a book one of these days to learn more about Solr

  6. noob Says:

    You saved bunch of hair follicles with this guide, thank you!

  7. admin Says:

    Your Welcome, I’m glad you still have a full set of hair :)

  8. Ian Sweeney Says:

    An excellent tutorial. A minor point to update is that step 2 of the downloads is no longer necessary because XAMPP 1.7.4 (and onwards) includes Tomcat in the basic download and no add-on is needed.

  9. admin Says:

    I guess enough people complained about it and they finally integrated Tomcat into the basic download. Thanks for the info.

Leave a Reply

Copyright © 2012 . All Rights Reserved . iCurious Media
Terms and Conditions . Privacy Policy . Site Map