Install Solr under Windows

Install Solr under Windows

Installing and getting Solr up and running is straight forward, as long as you follow these simple steps. I ran into problems myself trying to get Solr starting up under Tomcat, even after reading several posts explaining how to, which is why I wrote this post, explaining all the necessary steps. Feel free to make a comment, if you have any questions or run into problems.

1. Download Apache Tomcat from Apache Software Foundation. I downloaded and installed Tomcat 7.0.42 “32-bit/64-bit Windows Service Installer” under the location c:\Tomcat\

2. Download the latest version of “Solr”. I downloaded Solr 4.4.0.
– Open solr-4.4.0.zip, navigate to \example\solr and extract the directories and files to c:\solr\, so it contains; bin, collection1, README.txt, solr.xml and zoo.cfg

– Again in solr-4.4.0.zip navigate to \example\lib and extract all the jar-files into c:\Tomcat\lib\. Repeat the same procedure with the jar-files in \examples\lib\ext.

– In solr-4.4.0.zip navigate to \example\webapps and extract solr.war to c:\Tomcat\webapps\. If the file is called solr-versionNumber.war, rename it to solr.war

3. In C:\Tomcat\conf\Catalina\localhost create a file called “solr.xml” with following content, where you specify Solr docBase “c:/Tomcat/webapps/solr.war” and enviroment value “/Tomcat/webapps/”.

[xml]
<?xml version="1.0" encoding="UTF-8"?>
<context docBase="c:/Tomcat/webapps/solr.war" debug="0" crossContext="true" >
<environment name="solr/home" type="java.lang.String" value="/Tomcat/webapps/" override="true"></environment>
</context>
[/xml]

4. Open up C:\Tomcat\webapps\solr\WEB-INF\web.xml and uncomment the following and replace “/put/your/solr/home/here” with your solr location

[xml]
<env-entry>
<env-entry-name>solr/home</env-entry-name>
<env-entry-value>C:\Solr</env-entry-value>
<env-entry-type>java.lang.String</env-entry-type>
</env-entry>
[/xml]

During these steps you might have to stop and start your Apache Tomcat to be able to write to the files and reload the changes. To stop/start Apache Tomcat, click the Apache icon in the task bar and click “Stop service / Start service”.

Restart Apache Tomcat Windows

You should now be able to navigate to http://localhost:8080/solr/ and get the Solr admin site, presuming you installed Apache Tomcat on port 8080 (as per default)

Solr 4.4.0 admin page

If you run into problems, you can view the Catalina log located in c:\Tomcat\logs\catalina.date.log.