How to install Solr for sitecore

  1. Solr compatibility table:

    Before moving forward to solr installation, we have to know which version of Sitecore we are planning to install. Please follow the link to check Proper solr version: https://kb.sitecore.net/articles/227897

  2. Download SOLR:

    You can download your proper solr version from http://archive.apache.org/dist/lucene/solr/. Right now, we will install Sitecore 7.5.0.
    Please do the below steps to download:

  3. Install Java:

    This is very important to install proper jre and jdk in our machine. To do that. We have to browse and download the below.
    https://www.oracle.com/technetwork/java/javase/downloads/java-archive-javase9-3934878.html

  4. Test Solr from command line
    • Start Solr : To start the solr, you have to do the below
      1. Open Command Prompt as administrator
      2. Execute the command “”C:\solr\solr-7.5.0\bin\solr.cmd” -p 8993”
      3. Now Browse “http://localhost:8993/solr” from any of your browser.
      4. You should open the solr properly.
  5. Create Certificate at your local machine

    To Create certificate, you have to execute the below command in your command prompt as administrator

    • “C:\Program Files\Java\jre-9.0.4\bin\keytool.exe” -genkeypair -alias solr-ssl -keyalg RSA -keysize 2048 -keypass secret -storepass secret -validity 9999 -keystore solr-ssl.keystore.jks -ext SAN=DNS:localhost,IP:127.0.0.1 -dname “CN=localhost, OU=Organizational Unit, O=Organization, L=Location, ST=State, C=Country”
    • “C:\Program Files\Java\jre-9.0.4\bin\keytool.exe” -importkeystore -srckeystore solr-ssl.keystore.jks -destkeystore solr-ssl.keystore.p12 -srcstoretype jks -deststoretype pkcs12 -srcstorepass secret -deststorepass secret
    • After executing the above command, you should see two file in “C:\solr”
      1. solr-ssl.keystore.jks
      2. solr-ssl.keystore.p12
  6. Enable SSL in Solr

    To enable SSL, edit the solr.in.cmd. you will get this file in your { {Your windows directory }\solr-7.2.1\bin\ } .Open solr.in.cmd in edit mode and find “SSL-related” Uncomment properties starting with SOLR_SSL*:

    << gist >>
  7. Install certificate in your local machine :

    To install certificate in your local machine, you have to do the execute “C:\solr”\solr-ssl.keystore.p12”. Just to remember the below things when you are going to install the certificate :

    • Store Location Should be “Local Machine”
    • File name should be “C:\solr\solr-ssl.keystore.p12”
    • Password : secret
    • Certificate Store : Trusted Root Certification Authorities

    After successfully installation, we have to copy the below files under “C:\solr\solr-7.5.0\server\etc”

    • solr-ssl.keystore.jks
    • solr-ssl.keystore.p12

    Now, you can test if that works for https. To do that, lets do the below steps

    • Open Command Prompt as administrator
    • Execute the command : “C:\solr\solr-7.5.0\bin\solr.cmd stop -all”
    • And run “C:\solr\solr-7.5.0\bin\solr.cmd” -p 8993” again
    • Now Browse “https://localhost:8993/solr” from any of your browser.
    • You should open the solr properly.
  8. Setup Solr to run as a Windows service
    • Download NSSM from “https://nssm.cc/download”
    • You should see “nssm-2.24.zip”. You can place it under solr folder.
    • Unzip nssm-2.24.zip and it should be in “C:\solr\nssm-2.24”
    • Open Command Prompt as administrator
    • Execute “C:\solr\nssm-2.24\win64\nssm.exe Install SOLR7.5.0”
    • Nssm will popup and we have to set the path and name from here.
    • Path – C:\solr\solr-7.5.0\bin\solr.cmd
    • Startup directory C:\solr\solr-7.5.0\bin
    • Arguments – start -f -p 8983 (port on which SOLR will run)
  9. Solr Configuration is completed.
    Browse https://localhost:8993/solr for Solr Instance.