Community Documentation

Installing Apache Solr on Windows 2008 with Jetty Running as a Service

Last updated December 2, 2011. Created by mherchel on December 2, 2011.
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.

image


 


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)

image


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

image


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)

image


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.

image


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

image


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

image


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

image 



 


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.


image => image


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


image


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


image


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.


image


4. Finally run: net start Solr


image


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.


 

Comments

Works Perfectly thanks...

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!

Are there instructions

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

Probably you have used Solr

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.

Page status

No known problems

Log in to edit this page

About this page

Audience
Site administrators
Level
Intermediate
Keywords
Apache Solr, apachesolr, iis, windows

Site Building Guide

Drupal’s online documentation is © 2000-2013 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License. Comments on documentation pages are used to improve content and then deleted.
nobody click here