When it comes the time to install the Habitat Home demo, one can be daunted by the large number of additional modules to install on top of the Sitecore instance. Installation of the modules can be really time consuming, especially when having to install the demo on multiple machines. Not to mention the Habitat Home Commerce demo that can be installed on top of Habitat Home which requires Sitecore Experience Commerce 9.

Instead of installing all of this manually, a scripted solution exists.

Jean-François Larente, who works at Sitecore, created a very nice PowerShell solution to install everything with only a handful of commands. It is hosted in the Sitecore.HabitatHome.Utilities GitHub repository.

Clone the Repository

The first step is to clone the repository on your computer

git clone https://github.com/Sitecore/Sitecore.HabitatHome.Utilities.git

Installing Sitecore 9 and the Required Modules

The Sitecore Experience Platform (XP) 9 installation files are in the .\XP\install folder.

The install script is install-xp0.ps1. It installs the Sitecore Install Framework, downloads Sitecore 9 and all the required modules from dev.sitecore.net, installs Sitecore and the modules, creates and binds SSL certificates, adds application pool memberships, and updates SXA Solr cores. It is very complete but it cannot be called yet. It requires a configuration-xp0.json configuration file which is created by running 2 scripts.

Creating a Configuration File

The first script creates the configuration-xp0.json configuration file with default values. You call it in a PowerShell console:

.\set-installation-defaults.ps1

Overriding Configuration Values

It is likely that you want to apply some changes to the default values for your installation. This is the role of the set-installation-overrides.ps1.example script.

You have to duplicate the script file, remove the .example extension, and edit the file. Inside, there are common overrides to the default configuration values like user names, passwords, site name, site location…

The variables are the same as the ones in the set-installation-defaults.ps1 file. You can override any of the installation defaults script variables in the installation overrides script. The goal is to keep only the variables you need to override. Remove anything you want to keep as default.

Be aware that modifying variables like $assets.root, $site.prefix, $site.suffix, $site.webroot, $site.hostName, or $xConnect.siteName also requires to override any variable that depends on them to recompute their values.

Once your set-installation-overrides.ps1 file is ready, apply the overrides to your configuration-xp0.json configuration file by running it in a PowerShell console:

.\set-installation-overrides.ps1

Providing a Sitecore License

The last step before installing is to place a valid Sitecore license in the assets subfolder:

.\assets\license.xml

Speeding Up the Installation

Downloading Sitecore and the modules is quite long. If you already have them and you want a faster install, you can copy the files in the assets folder:

Note: The list of assets might have changed since the publication of this blog post. Check the assets.json file for the required assets.

Installing

Once your license is in place, start the installation by running this script in a PoweShell console:

.\install-xp0.ps1

Installing Sitecore Experience Commerce 9

The Sitecore Experience Commerce (XC) 9 installation is very similar to the Experience Platform. The files are in the .\XC\install folder.

Creating a Configuration File

The set-installation-defaults.ps1 script requires the configuration-xp0.json file from the .\XP\install folder created to install Experience Platform. It is merged with the Experience Commerce default values to create the configuration-xc0.json file. You call it in a PowerShell console:

.\set-installation-defaults.ps1

Overriding Configuration Values

Same as with Experience Platform, you have to duplicate the set-installation-overrides.ps1.example script file, remove the .example extension, and edit the file to remove or add anything you want to override.

Once your set-installation-overrides.ps1 file is ready, apply the overrides to your configuration-xc0.json configuration file by running it in a PowerShell console:

.\set-installation-overrides.ps1

Speeding Up the Installation

If you already have the assets and you want a faster install, you can copy the files in the assets folder:

Note: The list of assets might have changed since the publication of this blog post. Check the set-installation-defaults.ps1 and install-xc0.ps1 files for the required assets.

Installing

Start the installation by running this script in a PoweShell console:

.\install-xc0.ps1

Conclusion

Next time you see Jean-François Larente in person, buy him a drink! He deserves it.