Install Apache Solr and Tomcat under Windows

Solr logo

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.

Pre Requirements:

1. Download Java SDK version 7 or above from: http://www.oracle.com/technetwork/java/javase/downloads/index.html

2. Download Apache Tomcat from Apache Software Foundation; http://www.fightrice.com/mirrors/apache/tomcat/tomcat-7/v7.0.42/bin/apache-tomcat-7.0.42.exe

3. Download the latest version of “Solr”: http://psg.mtu.edu/pub/apache/lucene/solr/4.4.0

Installation and Configuration:

– 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 created a file called “solr.xml” with following content, where you specify solr docBase “c:/Tomcat/webapps/solr.war” and enviroment value “/Tomcat/webapps/”.

<?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>

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


<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>

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.

*** Notation If you got error 404 and 503, please go to

1. C:\Tomcat\webapps and delete directory named [solr], wait until new directory is called [solr] generate, go to C:\tomcat\webapps\solr\WEB-INF and edit file web.xml in section [Solr Home]

2. Go to Apache Tomcat Properties (Taskbar Notification -> right click on Apache Tomcat -> Configure) , in Java Tab; add [-Dsolr.solr.home=C:\solr] in the bottom line

Or in catalina.sh (/usr/share/tomcat/bin/catalina.sh):

JAVA_OPTS="-Dsolr.solr.home=/etc/tomcat6/solr -Djava.awt.headless=true -server -XX:NewSize=256m -XX:MaxNewSize=256m -XX:PermSize=256m -XX:MaxPermSize=256m -XX:+DisableExplicitGC"

Copy from: http://egeek.dk/install-solr-under-windows/