How to install Solr for sitecore
-
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
-
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:- Go to http://archive.apache.org/dist/lucene/solr/7.5.0/
- Download “solr-7.5.0.zip” and save in “C:\solr”. You can choose any folder.
- Unzip “solr-7.5.0.zip” and make sure we have “cmd” in “C:\solr\solr-7.5.0\bin”
-
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”-
JRE Runtime (JRE): To Install JRE, we have to do the below steps
-
Uninstall jre from control panel or follow the link :
https://www.java.com/en/download/help/uninstall_java.xml - Download jre-9.0.4_windows-x64_bin.exe from https://www.oracle.com/technetwork/java/javase/downloads/java-archive-javase9-3934878.html
- Install the exe.
-
Uninstall jre from control panel or follow the link :
-
Install the exe.
- Same approach we can uninstall the JDK
- Download “jdk-9.0.4_windows-x64_bin.exe” from https://www.oracle.com/technetwork/java/javase/downloads/java-archive-javase9-3934878.html
- Install the exe.
- Set the JAVA_HOME Variable: We can follow the guideline here: https://confluence.atlassian.com/doc/setting-the-java_home-variable-in-windows-8895.html
-
Now, Test Java in our machine. :
- Simply to go command promt
- Type : java -version and enter
- You should see “java version “9.0.4” Now, you are good to move forward.
-
JRE Runtime (JRE): To Install JRE, we have to do the below steps
-
Test Solr from command line
-
Start Solr : To start the solr, you have to do the below
- Open Command Prompt as administrator
- Execute the command “”C:\solr\solr-7.5.0\bin\solr.cmd” -p 8993”
- Now Browse “http://localhost:8993/solr” from any of your browser.
- You should open the solr properly.
-
Start Solr : To start the solr, you have to do the below
-
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”
- solr-ssl.keystore.jks
- solr-ssl.keystore.p12
-
-
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 >> -
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.
-
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)
-
Solr Configuration is completed.
Browse https://localhost:8993/solr for Solr Instance.