# Installing Sitecore 9 With Solr on Linux

I am having a hard time getting Sitecore 9 (SIF 2.0) installed where Solr is on a remote Linux box.

Basically I have removed the steps in the install powershell script that creates the solr cores and I have created them manually based on the default managed schema, with one exception: I updated the uniqueKey to point to the field _uniqueid and I added the field _uniqueid. I can create the cores.

When I try to install, the xconnect installation fails when it ties to update the schema. Here is the error:

[-------------------------------- ConfigureSolrSchemas [1] : ManageSolrSchema -------------------------------
[ConfigureSolrSchemas [1]]:[Requesting] https://mysolrurl:8983/solr
[ConfigureSolrSchemas [1]]:[Schema] Modifying Schema on https://mysolrurl:8983/solr : MyPrefix_Dev_
Install-SitecoreConfiguration : One or more errors returned from Solr request.
At D:\Websites\MySite\install.ps1:81 char:1
+ Install-SitecoreConfiguration @xconnectParams
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Install-SitecoreConfiguration

[TIME] 00:03:02
Invoke-ManageSolrSchemaTask : One or more errors returned from Solr request.
At C:\Program Files\WindowsPowerShell\Modules\SitecoreInstallFramework\2.0.0\Public\Install-SitecoreConfiguration.ps1:641 c
+                         & $entry.Task.Command @paramSet | Out-Default + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Invoke-ManageSolrSchemaTask  Here is my install script: #define parameters$prefix = "MyPrefix"
$dbPrefix = "MyPrefix"$PSScriptRoot = "D:\Websites\MyPrefix\Install"
$XConnectCollectionService = "$prefix.xconnect"
$sitecoreSiteName = "mysitename"$SolrUrl = "https://mysolrurl:8983/solr"
$SolrRoot = "/opt/solr"$SolrService = "Solr 6.6.2"
$SqlServer = "mysqladdress"$SqlAdminUser = "myuser"
$SqlAdminPassword="mypassword" #install client certificate for xconnect$certParams = @{
Path = "$PSScriptRoot\xconnect-createcert.json" CertificateName = "$prefix.xconnect_client"
RootCertFileName = "$prefix" } Install-SitecoreConfiguration @certParams -Verbose #install solr cores for xdb$solrParams = @{
Path = "$PSScriptRoot\xconnect-solr.json" SolrUrl =$SolrUrl
SolrRoot = $SolrRoot SolrService =$SolrService
CorePrefix = $dbPrefix } #Install-SitecoreConfiguration @solrParams #deploy xconnect instance$xconnectParams = @{
Path = "$PSScriptRoot\xconnect-xp0.json" Package = "$PSScriptRoot\Sitecore 9.0.2 rev. 180604
(OnPrem)_xp0xconnect.scwdp.zip"
LicenseFile = "$PSScriptRoot\license.xml" Sitename =$XConnectCollectionService
XConnectCert = $certParams.CertificateName SqlDbPrefix =$dbPrefix
SqlServer = $SqlServer SqlAdminUser =$SqlAdminUser
SqlAdminPassword = $SqlAdminPassword SolrCorePrefix =$dbPrefix
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\Sitecore 9.0.2 rev. 180604
(OnPrem)_single.scwdp.zip"
LicenseFile = "$PSScriptRoot\license.xml" SqlDbPrefix =$dbPrefix
SqlServer = $SqlServer SqlAdminUser =$SqlAdminUser
SqlAdminPassword = $SqlAdminPassword SolrCorePrefix =$dbPrefix
SolrUrl = $SolrUrl XConnectCert =$certParams.CertificateName
Sitename = $sitecoreSiteName SiteLocation = "D:\Websites\MyPrefix\Dev" XConnectCollectionService = "https://$XConnectCollectionService"
}

Install-SitecoreConfiguration @sitecoreParams


And here are the relevant parts of my managed schema (I started with the vanilla managed-schema from a fresh install):

<?xml version="1.0" encoding="UTF-8" ?>
<schema name="example-basic" version="1.6">

...

<dynamicField name="random_*" type="random" />

<!-- uncomment the following to ignore any fields that don't already match an existing
field name or dynamic field, rather than reporting them as an error.
alternately, change the type="ignored" to some other type e.g. "text" if you want
unknown fields indexed and/or stored by default

NB: use of "*" dynamic fields will disable field type guessing and adding
unknown fields to the schema. -->
<!--dynamicField name="*" type="ignored" multiValued="true" /-->

<!-- Field to use to determine and enforce document uniqueness.
Unless this field is marked with required="false", it will be a required field
-->
<uniqueKey>_uniqueid</uniqueKey>
<field name="_uniqueid" type="string" indexed="true" required="true" stored="true"/>

<!-- copyField commands copy one field to another at the time a document
is added to the index.  It's used either to index the same field differently,
or to add multiple fields to the same field for easier/faster searching.

<copyField source="sourceFieldName" dest="destinationFieldName"/>
-->

<!-- field type definitions. The "name" attribute is
just a label to be used by field definitions.  The "class"
attribute and any other attributes determine the real
behavior of the fieldType.
Class names starting with "solr" refer to java classes in a
standard package such as org.apache.solr.analysis
-->

<!-- The StrField type is not analyzed, but indexed/stored verbatim.
It supports doc values but in that case the field needs to be
single-valued and either required or have a default value.
-->
<fieldType name="string" class="solr.StrField" sortMissingLast="true" docValues="true" />
<fieldType name="strings" class="solr.StrField" sortMissingLast="true" multiValued="true" docValues="true" />

...

</schema>

• Try using fiddler to capture more information on the error, since it can lead to finding existing answers on the error. Also there is a good chance changing the id like that is part of the issue, but fiddler might point that out. – eglasius Jan 22 '19 at 8:24

I have not found a way to do this through SIF easily. At the end of the day, all that is happening is

• Creation of the collections
• Modification of config used for the XM collections (i.e., sitecore_master_index)
• Modification of the config used for the xDB collections (xdb and xdb_rebuild by default)
• Some config on the Sitecore side to tie it in.

After doing it manually in staging I decided to script it for production. I pulled down the resulting configs and made a python script to create the necessary collections with them.

https://github.com/AlexMayle/sitecore9-core-installer

If you clone the repo onto any of your Solr servers you can simply execute the following in the most basic case. There's options for more advanced cases.

python3 create_default_indexes.py | exec

That will take care of the first three steps. Just rip out the Solr tasks from the SIF config files and that should take care of the final step - assuming you use default collection names with the python script. If that's not the case, you'll need to manually edit the connection strings post-install.