Monday, December 14, 2009

Installing Solr 1.4 on Windows XP (Step by Step)

Introduction

I've been spending a lot of time using Solr recently.. So here's my guide to installing it on windows XP

Steps


Please follow the following steps to get Solr 1.4 running on a windows box:
  • Download Solr 1.4 from here
  • Download the latest Java JDK
Select Java SE Development Kit (JDK) jdk-6u17-windows-i586.exe

Installing Java SE Development Kit (JDK)

  • You can leave everything checked if you want. However the Java DB isn't required. I'm installing that also as I'll be using java else where on this computer.

  • The installer should ask you where you want to install the JDK. I've left mine with the default option:

Installing Tomcat

Windows Service Installer apache-tomcat-6.0.20.exe
  • Run the installation choosing everything except the Examples.
  • Install to 'C:\apache\Tomcat'
  • Set the Admin password as required
  • Set the Java Runtime location (In my case that's the one installed with the Java JDK not the standard)
C:\Progra~1\Java\jdk1.6.0_18\jre
  • Once installed checked that the service starts
  • If the service doesn't start copy msvcr71.dll from C:\Program Files\Java\jre6\bin to the windows dir
  • Test Tomcat to make sure you can access the admin page at http://127.0.0.1:8080
  • Stop the Tomcat service to prepare the Solr install

Installing Solr 1.4

  • Setup the Solr Directory e.g. c:\solr, d:\solr or whatever you want
  • Extract the Solr installation to a temporary location
apache-solr-1.4.0.zip
  • From within the extracted zip file copy the contents of examples\solr to the Solr directory you've created.
  • Copy the solr.war file into the tomcat webapps directory (it may be called something else, so rename it to solr.war as this determine the address to the site.)
apache-solr-1.4.0\example\webapps C:\apache\Tomcat\webapps
  • Right Click on the Tomcat's system tray icon and select configure...
  • Add to the end of the Java options: 
-Dsolr.solr.home=c:\solr (change the directory if you installed solr somewhere else.)
    • Right Click on the Tomcat's system tray icon and select Start.
    • If everything worked correctly, you should see tomcat's system tray icon go green.
    • Also you should be able to test Solr via http://127.0.0.1:8080/solr/admin/
    • As a final sanity check, If you look at the settings in the top left of the Solr admin page.
    • Make sure the Solr home is specified correctly. c:\solr (what you setup earlier)
    • Ensure the Computer is the Server you're working on

    17 comments:

    1. Great post, got Solr running in no time at all. You should make this version agnostic though as newer versions of the JDK are out at this time.

      ReplyDelete
    2. Cheers. I'm glad it helped someone else out. I use it every time i've got to install Solr on another windows box. Have fun with Solr. It's awesome..

      ReplyDelete
    3. Excellent post!! Thanks a lot!! This type of post saves a lot of time for dummies lyk me!!

      ReplyDelete
    4. Excellent post! save me a lot of time.

      I have a lot of XML and PDF files located on different directories.
      How can i assign and index these data files under solr with Tomcat?
      Does Solr support French data?

      Regards,

      ReplyDelete
    5. I use something called SolrNet to send information to Solr. I've never used indexed directory from XML or PDF Files. your best bet for this would be the Solr Wiki. http://wiki.apache.org/solr/

      ReplyDelete
    6. Thanks for the excellent post.

      ReplyDelete
    7. java.lang.RuntimeException: Can't find resource 'solrconfig.xml' in classpath or 'C:\solr\conf/

      Does anyone knows what this error means? I have win 7 installed.

      ReplyDelete
    8. Hi, Have a look in C:\Solr\Conf directory.. is there a solrconfig.xml file in that directory?

      Did you install Solr to C:\Solr?

      ReplyDelete
    9. Thanks for answer - my install was in C:\Solr\Solr. So I switched to C:\Solr -> it finds the xml files now. But now I receive error: java.lang.UnsatisfiedLinkError: no nio in java.library.path at java.lang.ClassLoader.loadLibrary.

      Is it possible that this is because of windows 7?

      ReplyDelete
    10. I've installed everything once more, according to your instructions. It works ))) Thanks a lot, god bless.

      ReplyDelete
    11. I've installed solr ... somebody knows how to install itas with a multi core solr ? ...

      ReplyDelete
    12. Does anyone know if I can use the Solr Spell Checker for unicode characters?

      ReplyDelete
    13. @666 Hey, you're best bet is to ask that question on stackoverflow.com using the solr tag.

      http://stackoverflow.com/questions/tagged/solr

      ReplyDelete
    14. Thanks for the suggestion :)

      ReplyDelete
    15. What if the cwd and solr home isn't quite right, but I get that screen? I am getting a messier C:\solr\example and solr\.\ for home??

      ReplyDelete