Installing Sitecore 9 to a Nonstandard Location

During my first Sitecore 9 (XP0 topology) installation, I noticed that we can’t change a physical installation path of both Sitecore website and XConnect. The default installation path is “c:\inetpub\wwwroot\”, but it may differ, depending on which drive is marked as a “system”. From my point of view, it isn’t always comfortable. For example, I store all projects in different partition. This article is about how I added an ability to manage the installation paths.

In case installation XP0 topology, we have two configuration files:

  • sitecore-XP0.json, which defines parameters and steps for installing Sitecore Instance;
  • xconnect-xp0.json, which defines parameters and steps for installing XConnect Instance.

First, we need to apply the following changes to both configuration files:

1) Add the parameter above:

   "InstallationPath": {
            "Type": "string",
            "Description": "The path to the folder where Sitecore will be installed"
        }

add parameter sitecore 9

Replace the following line:

   "Site.PhysicalPath": "[joinpath(environment('SystemDrive'), 'inetpub', 'wwwroot', parameter('SiteName'))]",

with the line below:

   "Site.PhysicalPath": "[parameter('InstallationPath')]",

replace sitecore 9

Now we are able to pass the installation path in install.ps1 script:

   
#define parameters
$prefix = "xp0"
$PSScriptRoot = "c:\Data\resourcefiles\xp0"
$XConnectCollectionService = "$prefix.xconnect"
$sitecoreSiteName = "$prefix.sc"
$SolrUrl = "https://localhost:8983/solr"
$SolrRoot = "c:\solr"
$SolrService = "Solr6"
$SqlServer = "PC\MSSQL2016"
$SqlAdminUser = "sa"
$SqlAdminPassword="your password for sa user"
$SitecoreInstallationPath="c:\inetpub\wwwroot\$sitecoreSiteName"
$XConnectInstallationPath="c:\inetpub\wwwroot\$XConnectCollectionService"

#install client certificate for xconnect
$certParams = @{
    Path = "$PSScriptRoot\xconnect-createcert.json"
    CertificateName = "$prefix.xconnect_client"
}
Install-SitecoreConfiguration @certParams -Verbose

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

#install xconnect instance
$xconnectParams = @{
    Path = "$PSScriptRoot\xconnect-xp0.json"
    Package = "$PSScriptRoot\Sitecore171002OnPremXp0xconnect.scwdp.zip"
    LicenseFile = "$PSScriptRoot\license.xml"
    Sitename = $XConnectCollectionService
    InstallationPath = $XConnectInstallationPath
    XConnectCert = $certParams.CertificateName
    SqlDbPrefix = $prefix
    SqlServer = $SqlServer
    SqlAdminUser = $SqlAdminUser
    SqlAdminPassword = $SqlAdminPassword
    SolrCorePrefix = $prefix
    SolrURL = $SolrUrl
}
Install-SitecoreConfiguration @xconnectParams

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


#install sitecore instance
$xconnectHostName = "$prefix.xconnect"
$sitecoreParams = @{
        Path = "$PSScriptRoot\sitecore-XP0.json"
        Package = "$PSScriptRoot\Sitecore171002OnPremSingle.scwdp.zip"
        LicenseFile = "$PSScriptRoot\license.xml"       
        SqlDbPrefix = $prefix
        SqlServer = $SqlServer
        SqlAdminUser = $SqlAdminUser
        SqlAdminPassword = $SqlAdminPassword
        SolrCorePrefix = $prefix
        SolrUrl = $SolrUrl
        InstallationPath = $SitecoreInstallationPath
        XConnectCert = $certParams.CertificateName
        Sitename = $sitecoreSiteName
    XConnectCollectionService = "https://$XConnectCollectionService"
    }
    
Install-SitecoreConfiguration @sitecoreParams

  

This solution is also applicable for XP1 topology. The same changes should be applied for each configuration file which serves for creating IIS websites.

You can download updated files by the following links:

For Sitecore 9.0 Initial Release (rev. 171002)

sitecore-XP0.json

xconnect-xp0.json

install.ps1

For Sitecore 9.0 Update-1 (rev. 171219)

sitecore-XP0.json

xconnect-xp0.json

install.ps1

For Sitecore 9.0 Update-2 (rev. 180604)

sitecore-XP0.json

xconnect-xp0.json

install.ps1

 

UPDATED: configuration files are have been added for new Sitecore update versions

Do you like this approach? Tell us what you think.


Do you need help with your Sitecore project?
VIEW SITECORE SERVICES