bizfx

Install Sitecore Experience Commerce 9.1 on a Developer Workstation

Sitecore Experience Commerce 9.1 was released in April 2019 and runs on Sitecore 9.1 Update 1.

Make sure you have a valid working instance of Sitecore 9.1.1 running before we begin. Download the Sitecore Experience Commerce 9.1 Initial Release On Premises Packages for On Premise 2019.04-3.0.163 and the Installation Guide - On Premise using the link below:

Sitecore Experience Commerce 9.1 Initial Release

sitecore commerce 9.1 download page

Important

Having installed Sitecore Experience Commerce over 50 times and dealing with unexpected issues, I want to take care of a few housecleaning items before we begin out Commerce install.

SSL Certificate

To install an SSL cert on your Sitecore 9.1.1 instance, run the following commands (replace xp0.sc with your domain host):


New-SelfSignedCertificate -DnsName xp0.sc -CertStoreLocation cert:\LocalMachine\My
$sslPassword = ConvertTo-SecureString "P@ssw0rd" -Force -AsPlainText
Export-PfxCertificate -Cert cert:\LocalMachine\My\FF0AC531A86BCFEA07D91D272393E81780C9EF4C -FilePath C:\xp0.pfx -Password $sslPassword

Import the generated PFX file into the Personal and Trusted Root Certification Authorities on your Local Computer Certificates

personalcertificates

trustedcertificates

Identity Server

Since your identity server is installed as part of the Sitecore 9.1.1 install, before you install commerce, you need to add CORS endpoints to the config. Modify the C:\inetpub\wwwroot\XP0.identityserver\Config\production\Sitecore.IdentityServer.Host.xml file and add the config below in the AllowedCorsOrigins section.


<AllowedCorsOriginsGroup1>http://XP0.sc|https://XP0.sc</AllowedCorsOriginsGroup1>
<AllowedCorsOriginsGroup2>https://sxa.storefront.com|http://sxa.storefront.com</AllowedCorsOriginsGroup2>

Note that you will already have the AllowedCorsOriginsGroup1 node, you need to make sure the https version of your host name exists in there.

Commerce Install

1. Download Sitecore.Commerce.2019.04-3.0.163.zip from Sitecore Experience Commerce 9.1 Download page.

2. Create a new folder c:\deploy (you can name it accordingly)

3. Unblock and Extract Sitecore.Commerce.2019.04-3.0.163.zip in to c:\deploy folder.

extract zip

4. Unzip SIF.Sitecore.Commerce.2.0.19.zip in to c:\deploy folder, this will create the C:\deploy\SIF.Sitecore.Commerce.2.0.19 folder.

5. Unzip Sitecore.Commerce.Engine.3.0.163.zip in to c:\deploy folder, this will create the C:\deploy\Sitecore.Commerce.Engine.3.0.163 folder.

6. Unzip Sitecore.Commerce.Engine.SDK.3.0.40.zip in to c:\deploy folder, this will create the C:\deploy\Sitecore.Commerce.Engine.SDK.3.0.40 folder.

extracted folders

7. Download PowerShell Extensions version 5.0 (Sitecore PowerShell Extensions-5.0.zip) from Sitecore Marketplace PowerShell Extensions Download page and copy it to the c:\deploy folder.

powershell

8. Download Sitecore Experience Accelerator 1.8.1 (Sitecore Experience Accelerator 1.8.1 rev. 190319 for 9.1.1.zip) from Sitecore Experience Accelerator 1.8.1 Download page and copy it to the c:\deploy folder.

sxa

9. Download MSBuild.Microsoft.VisualStudio.Web.targets (msbuild.microsoft.visualstudio.web.targets.14.0.0.3.nupkg) from MSBuild.Microsoft.VisualStudio.Web.targets Nuget Download page, add a .zip extension and extract the zip to a temporary location.

nugetwebtargets

10. Copy \tools\VSToolsPath\Web\Microsoft.Web.XmlTransform.dll file from the temporary directory (unzip of msbuild.microsoft.visualstudio.web.targets.14.0.0.3.nupkg.zip) and copy it to the c:\deploy folder.

11. Navigate to C:\deploy\SIF.Sitecore.Commerce.2.0.19 folder. Make a copy of the Deploy-Sitecore-Commerce.ps1 file and rename it specific to your deployment. I named it FirstCommerce-Deploy-Sitecore-Commerce.ps1.

12. Modify your FirstCommerce-Deploy-Sitecore-Commerce.ps1 file with the appropriate values specific to your environment. I would recommend that you replace all Resolve-Path in the ps1 file with local paths. Make sure you use \\ or escape \ (c:\deploy = c:\\deploy). Here are my changes:

configuration

SXAStorefrontModuleFullPath is set as Resolve-Path -Path "..\Sitecore Commerce Experience Accelerator Storefront 1.*.zip" by default but the file name is Sitecore Commerce Experience Accelerator Storefront 2.0.181.zip. Watch out for this especially if you are leaving the Resolve-Path.

13. Extract Sitecore Commerce Experience Accelerator Storefront 2.0.181.zip in to c:\deploy folder, this will create the C:\deploy\Sitecore Commerce Experience Accelerator Storefront 2.0.181 folder.

14. Unzip the package.zip folder in the same folder (C:\deploy\Sitecore Commerce Experience Accelerator Storefront 2.0.181). It might be better to use a tool like WinRar or 7-Zip to unzip package.zip file.

15. Open the xml file C:\deploy\Sitecore Commerce Experience Accelerator Storefront 2.0.181\package\items\master\sitecore\system\Modules\PowerShell\Script Library\CXA - Internal\Web API\CreateDefaultStorefrontTenantAndSite\{6FEC77C8-00DC-4B7B-9597-82588616A1F2}\en\1\xml.

16. Find the CreateCXATenant function on line 17. Insert the following Function before line 17 and save the xml file.

Before

<item name="CreateDefaultStorefrontTenantAndSite" key="createdefaultstorefronttenantandsite" id="{6FEC77C8-00DC-4B7B-9597-82588616A1F2}" tid="{DD22F1B3-BD87-4DB2-9E7D-F7A496888D43}" mid="{00000000-0000-0000-0000-000000000000}" sortorder="300" language="en" version="1" template="powershell script" parentid="{330C8219-7B1C-455F-9D48-ADF58BEA15B9}" created="20190411T104541Z"><fields><field tfid="{BADD9CF9-53E0-4D0C-BCC0-2D784C282F6A}" key="__updated by" type="Single-Line Text"><content>sitecore\admin</content></field><field tfid="{8CDC337E-A112-42FB-BBB4-4143751E123F}" key="__revision" type="Single-Line Text"><content>0f12c57e-4cd5-4033-814a-6f188621d248</content></field><field tfid="{25BED78C-4957-4165-998A-CA1B52F67497}" key="__created" type="datetime"><content>20171206T090838Z</content></field><field tfid="{D9CF14B1-FA16-4BA6-9288-E8A174D4D522}" key="__updated" type="datetime"><content>20181031T095825Z</content></field><field tfid="{B1A94FF0-6897-47C0-9C51-AA6ACB80B1F0}" key="script" type="Multi-Line Text"><content>Import-Function Validate-PowerShell
Test-PowerShell
Import-Function New-Tenant
Import-Function New-Site
Import-Function Get-ValidSiteSetupDefinition

$tenantRootPath = "/sitecore/content"

$tenantName = "Sitecore"
$siteName = "Storefront"
$hostName = "sxa.storefront.com"
$gridId = "{85E7A149-9009-43D8-96AC-58605ADE7777}"
$wireFrameThemeId = "{3F46272C-F3B8-4913-8C00-3816B436A4D3}"
$storefrontBrandedThemeId = "{48FFBFC8-E705-44E1-8ACD-6A714FFD09E3}"
$doVerbose = $false

Function CreateCXATenant

After

<item name="CreateDefaultStorefrontTenantAndSite" key="createdefaultstorefronttenantandsite" id="{6FEC77C8-00DC-4B7B-9597-82588616A1F2}" tid="{DD22F1B3-BD87-4DB2-9E7D-F7A496888D43}" mid="{00000000-0000-0000-0000-000000000000}" sortorder="300" language="en" version="1" template="powershell script" parentid="{330C8219-7B1C-455F-9D48-ADF58BEA15B9}" created="20190411T104541Z"><fields><field tfid="{BADD9CF9-53E0-4D0C-BCC0-2D784C282F6A}" key="__updated by" type="Single-Line Text"><content>sitecore\admin</content></field><field tfid="{8CDC337E-A112-42FB-BBB4-4143751E123F}" key="__revision" type="Single-Line Text"><content>0f12c57e-4cd5-4033-814a-6f188621d248</content></field><field tfid="{25BED78C-4957-4165-998A-CA1B52F67497}" key="__created" type="datetime"><content>20171206T090838Z</content></field><field tfid="{D9CF14B1-FA16-4BA6-9288-E8A174D4D522}" key="__updated" type="datetime"><content>20181031T095825Z</content></field><field tfid="{B1A94FF0-6897-47C0-9C51-AA6ACB80B1F0}" key="script" type="Multi-Line Text"><content>Import-Function Validate-PowerShell
Test-PowerShell
Import-Function New-Tenant
Import-Function New-Site
Import-Function Get-ValidSiteSetupDefinition

$tenantRootPath = "/sitecore/content"

$tenantName = "Sitecore"
$siteName = "Storefront"
$hostName = "sxa.storefront.com"
$gridId = "{85E7A149-9009-43D8-96AC-58605ADE7777}"
$wireFrameThemeId = "{3F46272C-F3B8-4913-8C00-3816B436A4D3}"
$storefrontBrandedThemeId = "{48FFBFC8-E705-44E1-8ACD-6A714FFD09E3}"
$doVerbose = $false

Function Write-Progress
{
	[CmdletBinding()]
	param(
		[Parameter(Mandatory = $false)]
		$Activity,
		[Parameter(Mandatory = $false)]
		$CurrentOperation,
		[Parameter(Mandatory = $false)]
		$Status,
		[Parameter(Mandatory = $false)]
		$PercentComplete,
		[Parameter(Mandatory = $false)]
		[switch]$Completed
		) process
	{
		# do nothing
	}
}

Function CreateCXATenant

17. Create package.zip from the package folder (C:\deploy\Sitecore Commerce Experience Accelerator Storefront 2.0.181\package).

18. Delete the package folder (C:\deploy\Sitecore Commerce Experience Accelerator Storefront 2.0.181\package).

19. Rename Sitecore Commerce Experience Accelerator Storefront 2.0.181.zip to 'Original Sitecore Commerce Experience Accelerator Storefront 2.0.181.zip'.

20. Package C:\deploy\Sitecore Commerce Experience Accelerator Storefront 2.0.181 folder to Sitecore Commerce Experience Accelerator Storefront 2.0.181.zip.

NOTE: #21, #22, #23 and #24 are for users who have modified their Sitecore 9.1.1 instance password to anything other than b. In my case I opted for a random password be generated as part of the install, so I have no choice but to do the following few steps.

21. Unzip Sitecore.Commerce.Engine.3.0.163.zip, modify Sitecore.Commerce.Engine.3.0.163\wwwroot\bootstrap\Global.json in the zip extracted folder and update your Sitecore admin password. Screenshot shown below:

globaljson

22. Modify the Sitecore.Commerce.Engine.3.0.163\wwwroot\data\Environments\PlugIn.Content.PolicySet-1.0.0.json in the zip extracted folder and update the Sitecore admin password. Screenshot shown below:

policyset

23. Rename the C:\deploy\Sitecore.Commerce.Engine.3.0.163.zip file to C:\deploy\Original - Sitecore.Commerce.Engine.3.0.163.zip

24. Zip up the Sitecore.Commerce.Engine.3.0.163 folder with file modifications to zip file C:\deploy\Sitecore.Commerce.Engine.3.0.163.zip

25. Run the C:\deploy\SIF.Sitecore.Commerce.2.0.19\FirstCommerce-Deploy-Sitecore-Commerce.ps1 script in the PowerShell window (Administrator mode).

runscript

runscript2

26. Take a break or make a friend in the meantime as the script is installing ;).

runscript3

runscript4

scriptdone

The install finally finished ;).

instancedone

bizfx

My blog post on Quickest way to install Sitecore 9.1.1 on a Developer Workstation.

If you have any questions or concerns, please get in touch with me. (@akshaysura13 on twitter or on Slack).