← back to the blog


How to Install Sitecore 9

Posted in Sitecore, Sitecore 9 by dake

Sitecore 9's installation is little different than Sitecore 8, it is recommended to use Sitecore Installation Framework, which you'll install the solution with Powershell. There are lots sites, videos are described how to setup Sitecore 9 already. This blog will be quick version or notes or how to setup Sitecore9. If you want to watch short Youtube video, I recommended watching Install Sitecore 9. The total is about 15 minutes, it starts from setup IIS, SQL Server 2016 SP1, SQL Server Data Tools 2015, Solr 6.6.2 and use Sitecore Installation Framework. I wish I could watch this video before I start to Install Sitecore 9 because I had made few common mistakes.

Now, following section will focus on How to set up the local development environment for Sitecore 9.

First, go to dev.sitecore.net to download package for XP Single.

After extract zip file, you'll see following files, you will probably need to modify *.json files, but you won't have to touch the *zip files.

  • Sitecore 9.0.0 rev. 171002 (OnPrem)_single.scwdp.zip
  • Sitecore 9.0.0 rev. 171002 (OnPrem)_xp0xconnect.scwdp.zip
  • xconnect-xp0.json
  • xconnect-createcert.json
  • sitecore-XP0.json
  • sitecore-solr.json
  • xconnect-solr.json

IIS setup, make sure you have IIS installed on your local, following is sample setting for you to reference.

Install SQL Server 2016 SP1

You can go to this link to download a free version of SQL Server 2016. At this blog, I downloaded the Developer version.

SQL Server 2016 Settings, there are few things you need to modify for SQL Server 2016.

  • Change Server Properties' Server authentication from Windows Authentication mode to SQL Server and Windows Authentication mode.
  • Change sa from Login Disabled to Enabled.
  • Change sa password.

Install SQL Server Management Studio

This blog I have installed SQL Server Management Studio 17.3, you can download from this link.

Install Web Platform Installer components

Install SQL Server Data Tools 2015

Install Solr 6.6.2

For Sitecore 9.0.0 rev. 171002, I think better to use Solr 6.x version. I have tried to use the 7.x version of the Solr but running into some issue when trying to create a module on Solr. 

You can download Solr 6.6.2 from here.

Setup Windows Service for Solr

Download NSSM

 

Add NSSM to System Variables's Path

Since I put my NSSM to the following location, add path as this C:\Files\nssm-2.24\win64. Once you add the executable path to System Variables, refresh command line, then you can use NSSM command on Command Prompt. Now, type nssm install solr. Enter information as following.

  • Path: C:\solr-6.6.2\bin\solr.cmd
  • Startup directory: C:\solr-6.6.2\bin
  • Arguments: start -f -p 8983
  • Service name: solr

Enable SSL for Solr

You can read Solr's document to setup SSL, but I recommended use this blog PowerShell to enable SSL for Solr, it is much easier. You'll have to change Java keytool.exe to the location on your pc. Following is the script from Quickly add SSL to Solr from kamsar.net.


param(
	[string]$KeystoreFile = 'solr-ssl.keystore.jks',
	[string]$KeystorePassword = 'secret',
	[string]$SolrDomain = 'localhost',
	[switch]$Clobber
)

$ErrorActionPreference = 'Stop'

### PARAM VALIDATION
if($KeystorePassword -ne 'secret') {
	Write-Error 'The keystore password must be "secret", because Solr apparently ignores the parameter'
}

if((Test-Path $KeystoreFile)) {
	if($Clobber) {
		Write-Host "Removing $KeystoreFile..."
		Remove-Item $KeystoreFile
	} else {
		$KeystorePath = Resolve-Path $KeystoreFile
		Write-Error "Keystore file $KeystorePath already existed. To regenerate it, pass -Clobber."
	}
}

$P12Path = [IO.Path]::ChangeExtension($KeystoreFile, 'p12')
if((Test-Path $P12Path)) {
	if($Clobber) {
		Write-Host "Removing $P12Path..."
		Remove-Item $P12Path
	} else {
		$P12Path = Resolve-Path $P12Path
		Write-Error "Keystore file $P12Path already existed. To regenerate it, pass -Clobber."
	}
}

try {
	$keytool = (Get-Command 'C:\Program Files\Java\jdk1.8.0_131\bin\keytool.exe').Source
} catch {
	$keytool = Read-Host "keytool.exe not on path. Enter path to keytool (found in JRE bin folder)"

	if([string]::IsNullOrEmpty($keytool) -or -not (Test-Path $keytool)) {
		Write-Error "Keytool path was invalid."
	}
}

### DOING STUFF

Write-Host ''
Write-Host 'Generating JKS keystore...'
& $keytool -genkeypair -alias solr-ssl -keyalg RSA -keysize 2048 -keypass $KeystorePassword -storepass $KeystorePassword -validity 9999 -keystore $KeystoreFile -ext SAN=DNS:$SolrDomain,IP:127.0.0.1 -dname "CN=$SolrDomain, OU=Organizational Unit, O=Organization, L=Location, ST=State, C=Country"

Write-Host ''
Write-Host 'Generating .p12 to import to Windows...'
& $keytool -importkeystore -srckeystore $KeystoreFile -destkeystore $P12Path -srcstoretype jks -deststoretype pkcs12 -srcstorepass $KeystorePassword -deststorepass $KeystorePassword

Write-Host ''
Write-Host 'Trusting generated SSL certificate...'
$secureStringKeystorePassword = ConvertTo-SecureString -String $KeystorePassword -Force -AsPlainText
$root = Import-PfxCertificate -FilePath $P12Path -Password $secureStringKeystorePassword -CertStoreLocation Cert:\LocalMachine\Root
Write-Host 'SSL certificate is now locally trusted. (added as root CA)'

Write-Host ''
Write-Host '########## NEXT STEPS ##########' -ForegroundColor Green
Write-Host ''
Write-Host '1. Copy your keystore to $SOLR_HOME\server\etc (MUST be here)' -ForegroundColor Green

if(-not $KeystoreFile.EndsWith('solr-ssl.keystore.jks')) {
	Write-Warning 'Your keystore file is not named "solr-ssl.keystore.jks"'
	Write-Warning 'Solr requires this exact name, so make sure to rename it before use.'
}

$KeystorePath = Resolve-Path $KeystoreFile
Write-Host ''
Write-Host '2. Add the following lines to your solr.in.cmd:' -ForegroundColor Green
Write-Host ''
Write-Host "set SOLR_SSL_KEY_STORE=etc/solr-ssl.keystore.jks" -ForegroundColor Yellow
Write-Host "set SOLR_SSL_KEY_STORE_PASSWORD=$KeystorePassword" -ForegroundColor Yellow
Write-Host "set SOLR_SSL_TRUST_STORE=etc/solr-ssl.keystore.jks" -ForegroundColor Yellow
Write-Host "set SOLR_SSL_TRUST_STORE_PASSWORD=$KeystorePassword" -ForegroundColor Yellow
Write-Host ''
Write-Host 'Done!'

Once install service and Enable SSL on solr then check the solr page, make sure page is loaded with https. If the page is not loading correctly, you'll have to find the issue and fix it.

 

Now verify before you run Sitecore Installation Framework.

  • Installed IIS
  • Installed SQL Server 2016 SP1
  • Configured SQL Server 2016
  • Install Solr and Enabled SSL on Solr

install.ps1


Import-Module SitecoreFundamentals
Import-Module SitecoreInstallFramework

#define parameters 
$prefix = "sitecore_900"
$XConnectCollectionService = "$prefix.xconnect"
$sitecoreSiteName = "$prefix.local"
$SolrUrl = "https://localhost:8983/solr"
$SolrRoot = "C:\solr-6.6.2"
$SolrService = "solr"
$SqlServer = "Your local sql server name"
$SqlAdminUser = "sa"
$SqlAdminPassword = "your sa password" 
$SqlAccountUser = "$prefix"
$SqlAccountPassword = "Pa##w0rd" 
$FilesRoot = "C:\FolderContainsAllSitecoreFileForInstall"
 
#install client certificate for xconnect 
$certParams = 
@{     
    Path = "$FilesRoot\xconnect-createcert.json"     
    CertificateName = "$prefix.xconnect_client" 
} 
Install-SitecoreConfiguration @certParams -Verbose



#install solr cores for xdb 
$solrParams = 
@{
    Path = "$FilesRoot\xconnect-solr.json"     
    SolrUrl = $SolrUrl    
    SolrRoot = $SolrRoot  
    SolrService = $SolrService  
    CorePrefix = $prefix 
} 
Install-SitecoreConfiguration @solrParams -Verbose

#deploy xconnect instance 
$xconnectParams = 
@{
    Path = "$FilesRoot\xconnect-xp0.json"     
    Package = "$FilesRoot\Sitecore 9.0.0 rev. 171002 (OnPrem)_xp0xconnect.scwdp.zip"
    LicenseFile = "$FilesRoot\license.xml"
    Sitename = $XConnectCollectionService   
    XConnectCert = $certParams.CertificateName    
    SqlDbPrefix = $prefix  
    SqlServer = $SqlServer  
    SqlAdminUser = $SqlAdminUser
    SqlAdminPassword = $SqlAdminPassword
    SolrCorePrefix = $prefix
    SolrURL = $SolrUrl      
    SqlMarketingAutomationUser = $SqlAccountUser
    SqlMarketingAutomationPassword = $SqlAccountPassword
    SqlReferenceDataUser = $SqlAccountUser
    SqlReferenceDataPassword = $SqlAccountPassword
    SqlProcessingPoolsUser = $SqlAccountUser
    SqlProcessingPoolsPassword = $SqlAccountPassword
} 
Install-SitecoreConfiguration @xconnectParams -Verbose

#install solr cores for sitecore 
$solrParams = 
@{
    Path = "$FilesRoot\sitecore-solr.json"
    SolrUrl = $SolrUrl
    SolrRoot = $SolrRoot
    SolrService = $SolrService     
    CorePrefix = $prefix 
} 
Install-SitecoreConfiguration @solrParams -Verbose
 
#install sitecore instance 
$sitecoreParams = 
@{     
    Path = "$FilesRoot\sitecore-XP0.json"
    Package = "$FilesRoot\Sitecore 9.0.0 rev. 171002 (OnPrem)_single.scwdp.zip" 
    LicenseFile = "$FilesRoot\license.xml"
    SqlDbPrefix = $prefix  
    SqlServer = $SqlServer  
    SqlAdminUser = $SqlAdminUser     
    SqlAdminPassword = $SqlAdminPassword     
    SolrCorePrefix = $prefix  
    SolrUrl = $SolrUrl     
    XConnectCert = $certParams.CertificateName     
    Sitename = $sitecoreSiteName         
    XConnectCollectionService = "https://$XConnectCollectionService"    
    SqlCoreUser = $SqlAccountUser
    SqlCorePassword = $SqlAccountPassword
    SqlMasterUser = $SqlAccountUser
    SqlMasterPassword = $SqlAccountPassword
    SqlWebUser = $SqlAccountUser
    SqlWebPassword = $SqlAccountPassword
    SqlFormsUser = $SqlAccountUser
    SqlFormsPassword = $SqlAccountPassword
    SqlProcessingTasksUser = $SqlAccountUser
    SqlProcessingTasksPassword = $SqlAccountPassword
    SqlReportingUser = $SqlAccountUser
    SqlReportingPassword = $SqlAccountPassword
    SqlMarketingAutomationUser = $SqlAccountUser
    SqlMarketingAutomationPassword = $SqlAccountPassword
    SqlReferenceDataUser = $SqlAccountUser
    SqlReferenceDataPassword = $SqlAccountPassword
    SqlProcessingPoolsUser = $SqlAccountUser
    SqlProcessingPoolsPassword = $SqlAccountPassword
} 
Install-SitecoreConfiguration @sitecoreParams -Verbose

Run install.ps1

If everything correct, you should see your site with the prefix.

 

Conclusion

Compare to how Sitecore 8 setup via SIM, use PowerShell is a little complicated since there is something have to set up before that. That could make some mistake too. So if you install Sitecore 9, I recommended doing following.

  1. Don't use Solr 7.*, use 6.* instead, for example, this blog use 6.2.2
  2. Don't use SQL Server 2014 or SQL Server 2014 SP2 if that's possible because some feature not work, so it's better to use SQL Server 2016.
  3. If you new, watch this video before try.

References