There are a couple of articles about Sitecore 9 on a Windows 8.1 development machine, and since it’s bit out of hand for me to upgrade to Windows 10 I’ve decided to take the bull by the horns and finally do it. Even that I’ve lost a bet with @SitecoreClimber that will manage to install Sitecore 9 to my Windows 8.1 in fist-second week of the launch without any troubles.
Windows 8.1 does not have Powershell 5.1 as its needed by SIF, so you can install it from here, as Windows Management Framework 5.1 includes also Powershell 5.1. An alternative way it to use this command choco install powershell
if you are using Chocolatey.
After a restart of the machine it’s time to install Sitecore Install Framework and Sitecore Fundamentals. So in a Windows Powershell opened as Administrator execute this:
Register-PSRepository -Name SitecoreGallery -SourceLocation https://sitecore.myget.org/F/sc-powershell/api/v2 Install-Module SitecoreInstallFramework Update-Module SitecoreInstallFramework
Run the following command in Windows Powershell to validate the modules installed:
Get-Module SitecoreInstallFramework –ListAvailable
After this you can continue with the installation of SOLR. The script that Jeremy Davis made in his blog post it’s not going to work as New-SelfSignedCertificate has different parameters in Windows 8.1, so you could use my adjusted script.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Param( | |
$solrVersion = "6.6.2", | |
$installFolder = "c:\solr", | |
$solrPort = "8983", | |
$solrHost = "solr", | |
$solrSSL = $true, | |
$nssmVersion = "2.24", | |
$JREVersion = "1.8.0_151" | |
) | |
$JREPath = "C:\Program Files\Java\jre$JREVersion" | |
$solrName = "solr-$solrVersion" | |
$solrRoot = "$installFolder\$solrName" | |
$nssmRoot = "$installFolder\nssm-$nssmVersion" | |
$solrPackage = "https://archive.apache.org/dist/lucene/solr/$solrVersion/$solrName.zip" | |
$nssmPackage = "https://nssm.cc/release/nssm-$nssmVersion.zip" | |
$downloadFolder = "~\Downloads" | |
## Verify elevated | |
## https://superuser.com/questions/749243/detect-if-powershell-is-running-as-administrator | |
$elevated = [bool](([System.Security.Principal.WindowsIdentity]::GetCurrent()).groups -match "S-1-5-32-544") | |
if($elevated -eq $false) | |
{ | |
throw "In order to install services, please run this script elevated." | |
} | |
function downloadAndUnzipIfRequired | |
{ | |
Param( | |
[string]$toolName, | |
[string]$toolFolder, | |
[string]$toolZip, | |
[string]$toolSourceFile, | |
[string]$installRoot | |
) | |
if(!(Test-Path –Path $toolFolder)) | |
{ | |
if(!(Test-Path –Path $toolZip)) | |
{ | |
Write-Host "Downloading $toolName…" | |
Start-BitsTransfer –Source $toolSourceFile –Destination $toolZip | |
} | |
Write-Host "Extracting $toolName to $toolFolder…" | |
Expand-Archive $toolZip –DestinationPath $installRoot | |
} | |
} | |
# download & extract the solr archive to the right folder | |
$solrZip = "$downloadFolder\$solrName.zip" | |
downloadAndUnzipIfRequired "Solr" $solrRoot $solrZip $solrPackage $installFolder | |
# download & extract the nssm archive to the right folder | |
$nssmZip = "$downloadFolder\nssm-$nssmVersion.zip" | |
downloadAndUnzipIfRequired "NSSM" $nssmRoot $nssmZip $nssmPackage $installFolder | |
# Ensure Java environment variable | |
$jreVal = [Environment]::GetEnvironmentVariable("JAVA_HOME", [EnvironmentVariableTarget]::Machine) | |
if($jreVal -ne $JREPath) | |
{ | |
Write-Host "Setting JAVA_HOME environment variable" | |
[Environment]::SetEnvironmentVariable("JAVA_HOME", $JREPath, [EnvironmentVariableTarget]::Machine) | |
} | |
# if we're using HTTP | |
if($solrSSL -eq $false) | |
{ | |
# Update solr cfg to use right host name | |
if(!(Test-Path –Path "$solrRoot\bin\solr.in.cmd.old")) | |
{ | |
Write-Host "Rewriting solr config" | |
$cfg = Get-Content "$solrRoot\bin\solr.in.cmd" | |
Rename-Item "$solrRoot\bin\solr.in.cmd" "$solrRoot\bin\solr.in.cmd.old" | |
$newCfg = $newCfg | % { $_ -replace "REM set SOLR_HOST=192.168.1.1", "set SOLR_HOST=$solrHost" } | |
$newCfg | Set-Content "$solrRoot\bin\solr.in.cmd" | |
} | |
} | |
# Ensure the solr host name is in your hosts file | |
if($solrHost -ne "localhost") | |
{ | |
$hostFileName = "c:\\windows\system32\drivers\etc\hosts" | |
$hostFile = [System.Io.File]::ReadAllText($hostFileName) | |
if(!($hostFile -like "*$solrHost*")) | |
{ | |
Write-Host "Updating host file" | |
"`r`n127.0.0.1`t$solrHost" | Add-Content $hostFileName | |
} | |
} | |
# if we're using HTTPS | |
if($solrSSL -eq $true) | |
{ | |
# Generate SSL cert | |
$existingCert = Get-ChildItem Cert:\LocalMachine\Root | where Subject -eq "CN=$solrHost" | |
if(!($existingCert)) | |
{ | |
Write-Host "Creating & trusting an new SSL Cert for $solrHost" | |
# Generate a cert | |
# https://docs.microsoft.com/en-us/powershell/module/pkiclient/new-selfsignedcertificate?view=win10-ps | |
$cert = New-SelfSignedCertificate –DnsName "$solrHost" –CertStoreLocation cert:\LocalMachine\My | |
# Trust the cert | |
# https://stackoverflow.com/questions/8815145/how-to-trust-a-certificate-in-windows-powershell | |
$store = New-Object System.Security.Cryptography.X509Certificates.X509Store "Root","LocalMachine" | |
$store.Open("ReadWrite") | |
$store.Add($cert) | |
$store.Close() | |
# remove the untrusted copy of the cert | |
$cert | Remove-Item | |
} | |
# export the cert to pfx using solr's default password | |
if(!(Test-Path –Path "$solrRoot\server\etc\solr-ssl.keystore.pfx")) | |
{ | |
Write-Host "Exporting cert for Solr to use" | |
$cert = Get-ChildItem Cert:\LocalMachine\Root | where Subject -eq "CN=$solrHost" | |
$certStore = "$solrRoot\server\etc\solr-ssl.keystore.pfx" | |
$certPwd = ConvertTo-SecureString –String "secret" –Force –AsPlainText | |
$cert | Export-PfxCertificate –FilePath $certStore –Password $certpwd | Out-Null | |
} | |
# Update solr cfg to use keystore & right host name | |
if(!(Test-Path –Path "$solrRoot\bin\solr.in.cmd.old")) | |
{ | |
Write-Host "Rewriting solr config" | |
$cfg = Get-Content "$solrRoot\bin\solr.in.cmd" | |
Rename-Item "$solrRoot\bin\solr.in.cmd" "$solrRoot\bin\solr.in.cmd.old" | |
$newCfg = $cfg | % { $_ -replace "REM set SOLR_SSL_KEY_STORE=etc/solr-ssl.keystore.jks", "set SOLR_SSL_KEY_STORE=$certStore" } | |
$newCfg = $newCfg | % { $_ -replace "REM set SOLR_SSL_KEY_STORE_PASSWORD=secret", "set SOLR_SSL_KEY_STORE_PASSWORD=secret" } | |
$newCfg = $newCfg | % { $_ -replace "REM set SOLR_SSL_TRUST_STORE=etc/solr-ssl.keystore.jks", "set SOLR_SSL_TRUST_STORE=$certStore" } | |
$newCfg = $newCfg | % { $_ -replace "REM set SOLR_SSL_TRUST_STORE_PASSWORD=secret", "set SOLR_SSL_TRUST_STORE_PASSWORD=secret" } | |
$newCfg = $newCfg | % { $_ -replace "REM set SOLR_HOST=192.168.1.1", "set SOLR_HOST=$solrHost" } | |
$newCfg | Set-Content "$solrRoot\bin\solr.in.cmd" | |
} | |
} | |
# install the service & runs | |
$svc = Get-Service "$solrName" –ErrorAction SilentlyContinue | |
if(!($svc)) | |
{ | |
Write-Host "Installing Solr service" | |
&"$installFolder\nssm-$nssmVersion\win64\nssm.exe" install "$solrName" "$solrRoot\bin\solr.cmd" "-f" "-p $solrPort" | |
$svc = Get-Service "$solrName" –ErrorAction SilentlyContinue | |
} | |
if($svc.Status -ne "Running") | |
{ | |
Write-Host "Starting Solr service" | |
Start-Service "$solrName" | |
} | |
# finally prove it's all working | |
$protocol = "http" | |
if($solrSSL -eq $true) | |
{ | |
$protocol = "https" | |
} | |
Invoke-Expression "start $($protocol)://$($solrHost):$solrPort/solr/#/" |
After Solr its installed and up and running make sure than all the other prerequisites are meet:
- Sitecore License must have xDB enabled
- MS SQL Server 2016 SP1 or later
- MS SQL Management Studio
- .Net Framework 4.6.2 or later
- Web Deploy 3.6
- Java Runtime Environment
- Packages for XP Single (On Premises deployment)
- Note: must log into https://dev.sitecore.net/ before downloading
- Microsoft SQL Server Data-Tier Application Framework (DAC Fx) (install both DacFramework.msi for x64 and x86)
- Microsoft System CLR Types for SQL Server 2016 (
install both SQLSysClrTypes.msi for x64 and x86)
- Microsoft System CLR Types for SQL Server 2016 (
- Microsoft SQL Server TransactSQLScriptDom (install both SqlDom.msi for x64 and x86)
- Extra step (added by me): Microsoft Shared Management Objects for SQL Server 2016 (install both SharedManagementObjects.msi for x64 and x86) since I do not have on my dev machine MS SQL Server 2016 SP1 or later or MS SQL Management Studio
Then make sure that you follow the changes to the scripts that Fabian is presenting here.
In short the changes are:
- Create a self-signed certificate in Windows 8.1
- Change xconnect-createcert.json
- Change the official installation script
Extra notes:
Note 1:
- Make sure that the script
New-SignedCertificateWindows81.ps1
is located in same place as the installation script so that can be picked up - Make sure that JRE bin folder does exist in the PATH Environment Variable, otherwise
New-SignedCertificateWindows81.ps1
will not work.
In case you already have a SSL certificate in your machine then the changes that Fabian is presenting are not needed as you should use this article for installing your solution Sitecore 9 installation with existing SSL that I’ve wrote last week.
Note 2: The steps #8, #9 and #10 from the prerequisites should be installed in all situations when you install Sitecore 9 and you do not have on your web server MS SQL Server 2016 SP1 or later or MS SQL Management Studio
Note 3: On my way to install Sitecore 9 when I’ve installed only x64 version of add-ons from prerequisites ( steps #8, #9 and #10) and apparently was not enough as I was getting bunch of errors, so I had to install x86 versions too.
One reply on “How to install Sitecore 9 on Windows 8.1”
Reblogged this on Sitecore TRICKS.
LikeLike