Last updated May 26, 2014. Created on December 2, 2011.
Edited by mherchel. Log in to edit this page.

Please note that this article was reproduced with permission from Bill Beckelman's website. The original article can be found here. This guide has been used succesfully with Drupal.


Initial Solr Setup


1. Install the latest Java JDK from http://www.oracle.com/technetwork/java/javase/downloads/index.html.
Make sure to select 64bit version if you need it.

Only local images are allowed. title="image" border="0" alt="image" src="/files/solr_windows_installation-1.png"
width="589" height="473">


 


2. Download Solr 1.4.1 from one of the mirrors at http://www.apache.org/dyn/closer.cgi/lucene/solr/
(at the time of writing, not all mirrors seem to be hosting 1.4.1, but most seem
to have at least 1.4.0)

Only local images are allowed. title="image" border="0" alt="image" src="/files/solr_windows_installation-2.png"
width="566" height="236">


3. Unzip the Solr download. You should have the files listed in the image
below. Open the example folder.

Only local images are allowed. title="image" border="0" alt="image" src="/files/solr_windows_installation-3.png"
width="166" height="297">


4. Copy the etc, lib, logs, solr, webapps, and start.jar folders to C:\solr
(you will need to create the folder at C:\solr)

Only local images are allowed. title="image" border="0" alt="image" src="/files/solr_windows_installation-4.png"
width="180" height="260">


5. Now open the C:\solr\solr folder and copy the contents back to the root
C:\solr folder. When you are done you can delete the C:\solr\solr folder.

Only local images are allowed. title="image" border="0" alt="image" src="/files/solr_windows_installation-5.png"
width="141" height="171">


At this point your C:\solr directory should look like the image below.

Only local images are allowed. title="image" border="0" alt="image" src="/files/solr_windows_installation-6.png"
width="157" height="199">


6. Solr can now be run at this point if you start it from the command line.
Change your directory to c:\solr and then run:  java
-Dsolr.solr.home=c:/solr/ -jar start.jar
    
<= slash direction seems to matter

Only local images are allowed. title="image" border="0" alt="image" src="/files/solr_windows_installation-7.png"
width="681" height="144">


7. If you go to href="http://localhost:8983/solr/">http://localhost:8983/solr/ you should be
greeted with the Welcome to Solr message.

Only local images are allowed. title="image" border="0" alt="image" src="/files/solr_windows_installation-8.png"
width="318" height="170"> 



 


Setup Jetty to Run as a Windows Service using NSSM


Now that Solr is up and running, we can work on getting Jetty to run as a
Windows service. Since Jetty comes bundled with Solr, all we need is a way to
run it as a service. There are several options to do this, but the one that I
have found works the best and is the most compatible across windows environments
is NSSM – the Non Sucking Service.


Once you download NSSM, open the win32 or win64 folder as appropriate and
copy nssm.exe to your c:\solr folder.


Only local images are allowed. title="image" border="0" alt="image" src="/files/solr_windows_installation-9.png"
width="150" height="114"> => Only local images are allowed. title="image" border="0" alt="image" src="/files/solr_windows_installation-10.png"
width="128" height="49">


1. Open an elevated command prompt and change the directory to C:\solr. and
then run:  nssm install Solr


Only local images are allowed. title="image" border="0" alt="image" src="/files/solr_windows_installation-11.png"
width="681" height="102">


A dialog will open. Select java.exe as the Application located at
C:\Windows\System32\


Only local images are allowed. title="image" border="0" alt="image" src="/files/solr_windows_installation-12.png"
width="350" height="188">


2. In the options input box enter: -Dsolr.solr.home=C:/solr/
-Djetty.home=C:/solr/ -Djetty.logs=C:/solr/logs/ -cp
C:/solr/lib/*.jar;C:/solr/start.jar -jar C:/solr/start.jar


Important! If you copy and paste the line above make sure to take out the
line break.


3. Click Install service. You should get a Service successfully installed
message.


Only local images are allowed. title="image" border="0" alt="image" src="/files/solr_windows_installation-13.png"
width="223" height="158">


4. Finally run: net start Solr


Only local images are allowed. title="image" border="0" alt="image" src="/files/solr_windows_installation-14.png"
width="681" height="102">


5. Jetty should now be running as a service. Check by going to http://localhost/8983/solr


 


Not working? The best way to see what is going on is to stop the service and
then run java.exe -Dsolr.solr.home=C:/solr/ -Djetty.home=C:/solr/
-Djetty.logs=C:/solr/logs/ -cp C:/solr/lib/*.jar;C:/solr/start.jar -jar
C:/solr/start.jar
from the C:\Windows\System32\ folder and review
all the log information in the output.


 

Looking for support? Visit the Drupal.org forums, or join #drupal-support in IRC.

Comments

choitz’s picture

Two things got me though: 6. Solr can now be run at this point if you start it from the command line.
Change your directory to c:\solr
I tried lots until I took the time to re-read this!!

Just subtle update on Setup Jetty to Run as a Windows Service using NSSM

A dialog will open. Select java.exe as the Application located at
C:\Windows\System32\

XXX WRONG ON 64 bit C:\Program Files (x86)\Java\jre7\bin XXX - needs JDK not JRE!
C:\Program Files\Java\jre7\

I made that harder than it should be!!!

Thanks though, brilliant walk through!

brad.baker’s picture

Are there instructions available for doing this on Apache Solr 4.1? These don't seem to work with the new builds. I get:

HTTP ERROR: 404
Problem accessing /solr/. Reason:
Not Found
--------------------------------------------------------------------------------
Powered by Jetty://

Alexander Drupal’s picture

Probably you have used Solr 4.x.
Try to use Solr 3.x

Please read "modules\search_api_solr\INSTALL.txt" for further info.
- Solr 4.x is not supported by this module yet.

mvdve’s picture

This is a nice tutorial for 4.4

Solr on IIS tutorial