Step by step guide to install Sitecore 9.1

12/10/2018

Install Sitecore 9.1

Sitecore-91-victory-screen

This is the screen you see after hours of hard work ;) - Sitecore_91_installation_Victory_screen

Step 1: Register the PowerShell repository

Open PowerShell in administrator mode. Register sitecoreGallery repository by using below command:

PS>Register-PSRepository -Name SitecoreGallery -SourceLocation https://sitecore.myget.org/F/sc-powershell/api/v2

Step 2: Install Sitecore installation framework

Install the Sitecore installation framework, we can do this in two ways:

Step 3: Verify the SIF installation

Verify the SIF is installed correctly, by using below command

PS>Get-Module SitecoreInstallFramework -ListAvailable

You should see the available list of SIF installations if all above steps went well.

ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 2.0.0 SitecoreInstallFramework {Export-WebDeployParameters, Get-SitecoreInstallExtension, Install-SitecoreConfiguration, Register-SitecoreInstallExtension...}

Step 4: Install Solr 7.2.1

According to Sitecore's recommendation, we need Solr 1.7.2 for Sitecore 9.1 version. Download it from  http://archive.apache.org/dist/lucene/solr/7.2.1 and unzip it to your C:/Solr folder.

Solr needs Java 1.8 or higher version if don't have java installed already, download and install from here (https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html)

Once Java is installed, you need to set up environment variables for java. Search for ThisPC/MyComputer open properties-> Advanced System settings -> Environmental variables.

  • Add new -> Vairiable name (JAVA_HOME) and Varible Value (C:\Program Files\Java\jdk1.8.0_191)
  • Edit Path -> Add New -> %JAVA_HOME%\bin

Verify your java installation is successful. 

PS> java -version

You should able to see java version and build numbers by giving the above command.

Now we are good to run Solr, remember we unzipped solr to C:/Solr. Navigate to the folder C:/Solr/solr-7.2.1/bin

 

PS> cd C:/Solr/solr-7.2.1/bin

PS>.\solr start

 

This should start your Solr at port 8983. Verify it by going to the URL: http://localhost:8983/solr/#/

Perfect, we have now a running Solr instance locally.

Step 5: Set up SSL for SOLR

This is the part I spend most of my time while installing. 

Luckily, Kamsar made our life's easier, download the script here and copy to the folder C:/Solr/solr-7.2.1/bin as solrssl.ps1 and run the below command:

PS> .\solrssl.ps1 -KeystoreFile C:\solr\solr-7.2.1\server\etc\solr-ssl.keystore.jks

You might get an error message saying "File cannot be loaded because it is not digitally signed!" Try running below command to give permissions for execution policy to run the script

Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass

Press 'Y' now run the script solrssl.ps1

you will see below: 

########## NEXT STEPS ##########

1. Copy your keystore to $SOLR_HOME\server\etc (MUST be here)

2. Add the following lines to your solr.in.cmd:

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

Done!

Please follow the above steps like kamsar advised, copy your keystore file that was generated under  C:\solr\solr-7.2.1\bin\solr-ssl.keystore.jks to C:\solr\solr-7.2.1\server\etc

Modify above lines at the bottom of solr.in.cmd

Now, we need to create .pfx file from our generated .jks file. Run below command:

PS> keytool -importkeystore -srckeystore "C:\solr\solr-7.2.1\server\etc\solr-ssl.keystore.jks" -srcstoretype JKS -srcstorepass secret -destkeystore "C:\solr\solr-7.2.1\server\etc\solr-ssl.keystore.pfx" -deststoretype PKCS12 -deststorepass secret

This should generate pfx under /server/etc.

Now, we need to add the certificate to the local computer. Follow the instructions here to do that. (https://www.thewindowsclub.com/manage-trusted-root-certificates-windows)

Uff, now check https://localhost:8983/solr/#/ this should now not complain.

Never knew it is this difficult to install an SSL certificate, its a 1step work in IIS for a self-signed certificate. Thanks, IIS.

Step 6: Run Solr as a windows service

SIF installation looks for windows Solr service, if we did not set up one it will fail with this error:

"Install-SitecoreConfiguration : Invalid namespace
At C:\ResourceFiles\XP0-SingleDeveloper.ps1:74 char:1
+ Install-SitecoreConfiguration @singleDeveloperParams *>&1 | Tee-Objec ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Install-SitecoreConfiguration

[TIME] 00:00:32
Get-CimInstance : Invalid namespace
At C:\Program
Files\WindowsPowerShell\Modules\SitecoreInstallFramework\2.0.0\Public\Tasks\Invoke-RemoveServiceTask.ps1:10 char:17
+ ... $instance = Get-CimInstance -Class win32_service -Filter "Name = '$Na ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : MetadataError: (:) [Get-CimInstance], CimException
+ FullyQualifiedErrorId : HRESULT 0x8004100e,Microsoft.Management.Infrastructure.CimCmdlets.GetCimInstanceCommand"

We need to take help of NSSM(The Non sucking  service manager ) for this. Download it from here (https://nssm.cc/ci/nssm-2.24-101-g897c7ad.zip) Unzip to your C:/Solr folder and rename it to nssm to make things simpler.

Open your command prompt/Powershell as an administrator, Run below command.

 

PS> cd C:/Solr/Nssm/Win64

PS>nssm install solr-7.2.1

 

This will open a popup add below values:

Path: C:\Solr\solr-7.2.1\bin\solr.cmd

Setup Directory : C:\Solr\solr-7.2.1\bin

Arguments: start -f -p 8983

This will install the solr as a windows service.

Step 7: Finally, time for running ps1 scripts to install Sitecore 9.1!

Download the Sitecore 9.1 from here (https://dev.sitecore.net/Downloads/Sitecore_Experience_Platform/91/Sitecore_Experience_Platform_91_Initial_Release.aspx) I am installing XP0 (single) which is a full Sitecore installation with Identity/Xconnect/Website.

Once you downloaded the Sitecore 9.1.0 rev. 001564 (WDP XP0 packages).zip, unzip it to C:/resourcefiles. You will find 4 zip folders inside it. Unzip XP0 Configuration files 9.1.0 rev. 001564. You will now find below files in C:\resourcefiles\XP0 Configuration files 9.1.0 rev. 001564

  • Createcert.json
  • IdenttityServer.json
  • Prerequisites.json
  • Sitecore-solr
  • Sitecore-XP0
  • xconnect-solr
  • xconnect-xp0
  • XP--SingleDeveloper.json
  • XP0-SingleDeveloper.Ps1

Copy them into C:/resourcefiles. Also copy your license.xml into c:/resourcefiles. Edit below config in XP0.SingleDeveloper.ps1

  • $SitecoreAdminPassword = "Password you want here"
  • $SCInstallRoot = "C:\ResourceFiles" (if you have unzipped your Sitecore zip folder in a different place)
  • $SolrRoot = "C:\Solr\Solr-7.2.1" (if you have added Solr to different folder)
  • $SqlServer = "YourSQLServerName"
  • $SqlAdminUser = "SQL admin username"
  • $SqlAdminPassword = "SQL password"

Ok, all config changes are now done.

Open your PowerShell in admin mode. 

PS>cd C:/resourcefiles

PS>.\XP0-SingleDeveloper.ps1

 

Run above command and keep your fingers crossed ;) Hopefully it will install xconnect, identity and Sitecore site.

Happy Sitecore!!! let me know if you find any issue.