Solr Setup for Sitecore XP

Solr

As we continue through the steps for Sitecore Experience Platform installation, the next thing we must have is Solr. This tries to simplify that process.

Background

When installing Sitecore 9 for local development or on-premise for your organization Solr is now the only search provider fully supported. Lucene can still be used to support search within the Context Editor, but all analytics related, and site search scenarios now use Solr or when in the cloud Azure Search Provider.

The following guide will be focused on setting up Solr to support Sitecore 9 on local developer’s machine, where everything (SQL, Sitecore, Solr, etc…) are all installed on the same machine. The steps taken can be used to setup an all in one development or QA server, but should not be used for production setup.

Choose a method

When installing Solr there are many different options that become available, from a direct install, to a pre-packaged solution like Bitnami, a cloud solution, or even a Docker container.

I initially set out to write this guide leveraging Bitnami, as I’ve had a lot of success and quick setup leveraging it, but as it happens old versions of their packages are difficult to find, and Sitecore 9 is tied to Solr 6.6.2. I repeat Sitecore 9.0 update 1 is tied to Solr 6.6.2!!! (I’ve burned a week or so trying to make it work with Solr 7.2 during this series.)

Docker is an intriguing scenario to me, but I’ve got a lot more learning to do before I can successfully get up and running, and I’m in a hurry to start my Sitecore XP 9 life…so this lands me with doing a traditional local install.

As mentioned, Solr is a critical component to Sitecore XP 9, and historical a critical piece to large site implementations. To that benefit there are many write-ups out there regarding Solr installs for Sitecore. The one I found to be very helpful was done by fellow MVP Jeremy Davis. Who has written up Sitecore Installation Framework (SIF) PowerShell module to simplify and streamline the installation you can read his article at https://jermdavis.wordpress.com/2017/11/13/solr-installs-with-sif/.

I’ll be walking you through the steps I took leveraging his excellent PowerShell module.

Steps

  1. Ensure PowerShell will allow for running of unsigned modules by opening a PowerShell prompt as Admin
    Run Set-ExecutionPolicy Unrestricted
  2. Install Java if you don’t already have it.
  3. Install Sitecore Installation Framework (SIF), if you need this check out my how-to from last week .
  4. Copy Jeremy’s PowerShell module code into a new file name ‘SolrInstall-SIF-Extensions.psm1‘ from his Gist at https://gist.github.com/jermdavis/49018386ae7544ce0689568edb7ca2b8#file-solrinstall-sif-extension-psm1
  5. Copy the associated JSON config into a file named ‘SolrInstall-Config.json‘ from https://gist.github.com/jermdavis/49018386ae7544ce0689568edb7ca2b8#file-solrserver-json.I’ve created a fork of the config JSON file that includes updates for JRE runtime and most importantly updated NSSM version for Windows 10 Creator Update machines, find it at https://git.io/vAJXS.
    Solr Install - Files
  6. Open the config JSON, SolrInstall-Config.json, in your preferred editor (my recommendation is Visual Studio Code)
  7. Review the Parameters section and confirm that the default values are correct for your installation. Note for Sitecore 9.0 and 9.0 update 1 do NOT change the Solr version. I found I needed to change the following

    JREVersion => 9.0.4, this should be the JRE value used in the folder path to your Java installation, ie C:\Program Files\Java\jre-9.0.4

    NSSMVersion => 2.24-101-g897c7ad, there is a known issue with stable 2.24 version of Non-Sucking Service Manager on Window 10 machines where it will not start the service.

    SolrHost => sitecoresolrMake note of this name as it will be critical to future steps of the install process

    SolrPort – should be updated if you already have an instance of Solr running on the default port 8983.

  8. Confirm the Variables point to valid paths on your machine. I found the following required updating for me

    JREPath => C:\Program Files\Java\jre-

    NSSMSourcePackage => https://nssm.cc/ci/nssm-

  9. Open a PowerShell command prompt as Admin.
  10. Confirm SIF is update and installed by running
     Update-Module SitecoreInstallFramework
  11. Confirming everything installed correctly is as easy as running the following command, at time of writing the current version is 1.1.0
     Get-Module SitecoreInstallFramework -ListAvailable
  12. Change directory to the location of your config JSON and PowerShell Module file
  13. Before running the install the PowerShell Module needs to be placed in one of the known module library locations, found via running.
     $env:PSModulePath

    Solr Install - Module Locations
    NOTE: The psm1 file needs to be placed into a folder of the same name minus the extension with in the location you pick above.

  14. Run the install via the following command
     Install-SitecoreConfiguration .\SolrInstall-config.json

    Solr Install - Install Script
    NOTE: If you end up with the install running and then failing with a message of “Failed to start service ‘solr-6.6.2 (solr-6.6.2)'” then you are most likely facing the NSSM Windows 10 issue, and will need to either manually install the pre-release build or delete what you have and re-run the install job with an updated config such as this one https://git.io/vAJXS.
    Solr Install - Install Script - Service Start Error

  15. Solr should open in your browser or you should be able to reach it via: HTTPS://sitecoresolr:8983/solr
    Solr Install - Solr Admin Screen
Advertisements

One thought on “Solr Setup for Sitecore XP

  1. Pingback: Experience Sitecore XP | The Code Attic

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.