Installing Sitecore 9.0.1 – Part 2/3 – Installing Solr with SSL enabled

I have shown you how to prepare virtual machine and all prerequisites to be able to install Sitecore 9.0.1 in my previous post.

Today I will continue where I left last time and I will show:
– installation of Solr
– setting up Solr as Windows Service
– running Solr with SSL

You can find more information about these topic further in installation guide (link can be found at the end of this article) in chapters 2.1.7 and 2.3.4.

Sitecore supports the following index providers:

  • Solr 6.6.2 – For the XP Single (XP0), XP Scaled (XP1) and XM Scaled (XM1) topologies, Solr is the default search provider.
  • Azure Search – The Azure Search provider is supported and recommended for Azure Cloud PaaS deployments only.
  • Lucene

Solr is default search provider out of the box so you don’t need to configure anything or change any installation scripts. It is great choice for scaling in oppose to Lucene. It also does not require internet connection like Azure Search during development. Therefore for development purposes is Solr the best choice.

Let’s get started then.

1)
Download and install Java Runtine Environment 8 if you already don’t have it on virtual machine:
http://www.oracle.com/technetwork/java/javase/downloads/index.html

You can always verify whether java is installed by opening Command Prompt and running

java -version

command.
If it’s installed, you should see this:
javaversion

At the time of writing this blog post I have chosen this version – Java SE 8u161/ 8u162 of JRE on that page:

jre1

In the next page I have chosen JRE 8u162. You need to “Accept license agreement” and choose Windows x64 Offline:

jre2

Install this package by navigating through wizard. I have chosen default values.

2)
Download installation package of Solr from your nearby mirror:
http://www.apache.org/dyn/closer.lua/lucene/solr/6.6.2

3)
Unzip package downloaded in step 2 into folder C:\Solr\solr-6.6.2 on your VM. If you choose different location, adjust below-mentioned configuration and scripts accordingly.

solrunpacking

4)
Let’s quickly check whether Solr is installed correctly by starting it.

– Open Command Prompt and navigate to Solr bin folder e.g. C:\Solr\solr-6.6.2\bin
– Run command

solr.cmd start

– Run command

solr.cmd stop -p 8983

You should see something similar on your screen:
solrtestrun

We have now verified that Solr is correctly installed and can be run on port 8983.

5)
Running Solr as Windows Service.

I am always setting Solr to run as Windows Service and start with VM. This is saving me time as I don’t need to do it manually each Windows Server start and the biggest benefit – I don’t need to remember to do so! Automate as much as possible 😉

Download handle utility NSSM -> https://nssm.cc/download
Unzip files into your desired directory e.g. C:\nssm.

Open Command Prompt and run command to navigate to win64 subfolder:

cd C:\nssm\nssm-2.24\win64

Afterwards run this command:

nssm install Solr

This will open dialog for you:
nssm1

Specify path to your Solr cmd file in “Path” field and set “start -f -p 8984” in “Arguments” field.
I have changed here default port from 8983 to 8984. We will use SSL with Solr so I it’s always good to change default values so you are aware that something has been changed and it’s not ordinary.

Switch to “Details” tab and specify “Display name” and “Description” fields as you wish or according to my settings:
nssm2

These values will be visible in “Services” application in Windows Server.

Hitting “Install Service” button will create Windows service for Solr and also open this dialog:
nssm3

Open “Services” on Windows Server and verify that you have Solr service in list of services:
serviceswithsolr

Run this service.

Open your favorite browser and navigate to http://localhost:8984/solr/ :
solrrunning

Everything is now prepared for last step before finishing setting up Solr for Sitecore 9.

6)
Running Solr on SSL

Download SolrSSL.ps1 from this github repository:

Thanks kamsar for share 😉

You can also find this file in my repository together with other files that will be needed later on during installation.

Copy this file to C:\resoucefiles\ folder.

Open PowerShell command prompt. Do not use Powershell ISE, it won’t work with it!

solrssl

Specify full path to keytool located in your freshly installed JRE.
For me it was

C:\Program Files\Java\jre1.8.0_162\bin\keytool.exe

Mind “Next steps” warning at the end of script:
solrssl2

Follow highlighted instructions.

So from C:\resourcefiles move files with filenames starting with “solr-ssl.keystore”
solrssl3

to “C:\Solr\solr-6.6.2\server\etc”:
solrssl4

Navigate to C:\Solr\solr-6.6.2\bin and open solr.in.cmd in notepad or any other editor:
solrssl5

Paste following lines at the end of the file or basically anywhere in the file:

set SOLR_SSL_KEY_STORE=etc/solr-ssl.keystore.jks
set SOLR_SSL_KEY_STORE_PASSWORD=secret
set SOLR_SSL_TRUST_STORE=etc/solr-ssl.keystore.jks
set SOLR_SSL_TRUST_STORE_PASSWORD=secret

Appending these kind of changes is always best practice.

Now restart Solr service:
solrssl6

Open https://localhost:8984/solr/ in your browser.
Mind the https at the beginning instead of http and port 8984 instead if 8983.
Approve security exceptions and verify secret keystores in the log on dashboard page:
solrrunningonssl

That’s it for today.
In my next post I will conclude this series with finally installing some goodies – Sitecore 9.0.1 🙂

——————————————————
Used sources:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

Create a website or blog at WordPress.com

Up ↑

%d bloggers like this: