When I do research on Sitecore topics, I often want to try the findings on my own to understand exactly how Sitecore reacts. And there is no better way to doing so than on a Sitecore demo environment. Here I can try whatever is necessary without any worries and at the end of the day wipe out everything and return to a shiny-clean fresh new environment the next time round. So, without further redo, let’s get to the (virtual) machines!
What is the goal?
The goal is to have a virtual machine installed, where there is a Sitecore installation to test things out. The installation I am going to do is not just a vanilla install (clean install), but it will also contain the Launchsitecore demo website on it. We will set up the sandbox so that:
- there is a single installation of Sitecore 8
- it is possible to access the installation from the virtual machine itself, the host machine and any other machine on the same network
- it contains some tools to dig a little into the solution and understand better, what is going on under the hood.
Fairly basic – we have to start on a clean installation of Windows (in this case I used Server 2012, but it is ok to go with Win 7, 8, 8.1 or server 2008 R2 and of course 2012 R2). For the full list of supported Windows operating systems, you can check the Sitecore Installation Guide. We also need to have the SQL Server installed – don’t forget to also install the SQL Management studio, so that you can dig into the details of the databases. In older versions of Sitecore (up to 7.2) you would also need SQL Server Management Studio to attach properly the Analytics database. For my sandbox environment I use Oracle VirtualBox as the hosting environment, but of course, any other virtualization or bare-metal platform will do. Now let’s set up all the rest.
Servers, frameworks and support applications
Sitecore requires IIS and .NET Framework 4.5, including MVC. There are two ways of setting this up: manual and scripted – both of them are described below.
Manual setup of IIS and .NET
IIS and .NET 4.5 are native parts of Windows, so it is simple to add them immediately from the “Server Manager”. Simply open Manage -> Add roles or features and select the following additional options – all others can be left to defaults:
- Server Roles
- (add) Web Server (IIS)
- Functions of the .NET interface 4.5
- (add) ASP.NET
- Functions of the .NET interface 4.5
- Role Services
- Web Server
- Common HTTP Features
- (add) HTTP Redirection
- (add) WebDAV Publishing
- Common HTTP Features
- (add) Internet Information Services Hostable Web Core
- Web Server
As soon as you have all of this selected, you can proceed with the installation. At this point you can also choose to save the configuration as an XML file, so that you can later install the same setup using the scripted setup. And voilà the job is done.
Automated setup of IIS and .NET
It is also possible to set up the environment as described above, using PowerShell and the XML configuration file that defines what has to be installed. To install it, open up PowerShell as administrator and then just type: Set-ExecutionPolicy -Unrestricted and then Install-WindowsFeature -ConfigurationFilePath PathToFile The path can be either local, such as C:\path_to_file, or even remote such as \\SERVER\location\path_to_file. You can grab a copy of the XML file I generated here: IIS Sitecore Config. I like using the automated setup in order to be quicker with the installation of a new environment and also to be consistent and not to make any mistakes in the click-job. I would not consider it however the best starting point for learning how to install IIS and .NET 🙂
Setup of MongoDB
With Mongo, you need to do a two-step setup. First you need to install Mongo binaries and then you need to set up the Windows Service. In this scenario, I am considering a single-server installation on Windows, but in production, on a distributed environment, you could also go for Mongo on Linux based machines – Vasily Fomichev wrote a very nice blog post on installing MongoDB on Azure, using Linux as a service for Sitecore 8. To install the MongoDB, grab the latest version of MongoDB and install it. Now you need to set up the service. To set up the service follow the instructions on the MongoDB Documentation site. If you want to save up some time, here goes another PowerShell script that sets up the service, creates a log file and creates and stores these information in a configuration file. Then it starts the Windows service. Remember to still set the Execution policy to unrestricted.
# Setup of folders and file names for the MongoDB installation
$mongoPath = "Path-to-MongoDB-Folder"
$mongoDbConfigPath = "$mongoPath\mongod.cfg"
$dbPath = "Path-To-Data-Folder"
& $mongoPath\bin\mongod.exe --config $mongoDbConfigPath --install
& net start mongodb
For example, you could set up the values in the variables like this:
$mongoPath = "C:\Program Files\MongoDB 2.6 Standard"
$mongoDbConfigPath = "$mongoPath\mongod.cfg"
$dbPath = "C:\MongoData"
Now you are ready to connect to the MongoDB using the Windows Service and therefore Sitecore can attach to it.
If you were wondering how about security, MongoDB installs by default without any security applied, so you can connect immediately. This of course should never be left without change on a production environment.
There are two pieces of additional software that we will install: Robomongo and SIM – Sitecore Instance Manager.
Since there is no native tool in MongoDB, similar to SQL Management Studio in MSSQL, we can reach for Robomongo. Robomongo helps to explore and understand what data get stored in the MongoDB visually. Moreover, it comes for free. You can get Robomongo on the official download page. Alternatively, you could also grab a copy of MongoVue, which is a similar tool. To connect to the database with Robomongo, simply open the application and create a new connection without any username and password to the pre-defined address – localhost on port 27017. From now on, you can immediately see, what is really happening in Mongo, when new visits are generated on the website.
To install Sitecore, you could use several methods, among which two are the most straightforward: the Sitecore installer (everything is bundled in a file) or using SIM with the ZIP archive. Using the standalone installer is fairly easy – just run it and set the paths and passwords accordingly. The second method is more advanced and gives you more control. This is the method that I am going to explain. Get the latest version, on the Sitecore Marketplace and simply unzip the content to a folder. Open up the SIM.Tool.exe and then set up the following:
- Instances Root Folder: C:\inetpub\wwwroot
- Local Repository: anywhere, where there is the Sitecore zip installation file will be. You can create a folder, where you would store all Sitecore installation files, so that you could easily select the version of choice for a given installation without downloading it every time.
- Sitecore License File: The path to the license file. In order to install any instance and version of Sitecore you need to have a valid license file.
- SQL Server connection string: click to the dots on the right side of the field and insert the connection information for the SQL Server. If you, like me, have SQL Server installed on the same server, you can use (local) as the data source – do not forget to include the brackets () – and the login credentials, if you use Mixed mode for SQL login. For the sake of a sandbox installation, you can use the “sa” user, but this should never be the case on a production environment. As soon as you have the data filled in, you can click on ok and the connection string is automatically created. If it is without any errors, the installation will proceed.
- If you use SQL Server 2012, you need to modify the user account, under which SQL Server’s “NETWORK SERVICE” is running. To do that, just follow the instructions written here: http://technet.microsoft.com/en-us/library/ms345578.aspx. For the purpose of installing a sandbox system in an isolated environment it is ok to run the SQL service as Administrator.
- Now you can click on “Grant” to grant access to the www folder.
Job done. Now let’s go for Sitecore.
To install Sitecore with SIM, you need to download the ZIP archive of the Sitecore site root and then:
- Open SIM and click on Install Instance
- Name the site at will (in this case I named it launchsitecore). If you name the site, everything else will rename accordingly.
- Now just click through all the steps without selecting anything else and let SIM install Sitecore.
Now you can run the fresh instance immediately on http://launchsitecore/ and log in on http://launchsitecore/sitecore. Remember that on every fresh start of Sitecore (and pretty much any .NET application in IIS) you need to wait a little longer at the beginning for caches and other operations to start. So far, this is just an empty Sitecore instance. Let us now proceed with installing the Launchsitecore website.
You can chose whether to download the MVC or Webforms version of the application – just make sure you are downloading the application that is made for the version of Sitecore you have installed.
After you have downloaded the Launchsitecore application, go to Sitecore -> Desktop -> Development Tools -> Package Importer and upload the package Launchsitecore. Select to overwrite everything and let the package be installed. As soon as you have the package installed publish the whole site. Now you have the Launchsitecore website installed and available on the front-end.
Make the site available to other users
So far, everything we have done, is only available on our local machine. There is no way of getting to the Launchsitecore website from an external location. In order to achieve this in a simple way, we have to do the following:
- Set IIS bindings
- Adjust the Windows firewall
- (Optional) If you are running this in a virtual machine, make sure networking is set properly.
Setting IIS Bindings
An IIS binding allows IIS to send the correct website when prompted. When you install IIS, there is a default binding to the IIS Default Website (the one that shows you the IIS logo). We are going to change that, so that the default website is our freshly installed Launchsitecore website.
- Start IIS by running [Win+R] the command: inetmgr.
- In IIS right click on the folder Default Web Site and then click on Bindings
- In Bindings find the only binding that has the host name empty and open it
- Write anything in the host name (we will never use this website again) and click on OK. By doing this, we have freed the default (empty) hostname that we need to use on the Launchsitecore website.
- Open the Bindings for Launchsitecore
- Add a new binding
- In order for the “OK” button to activate, just press [Space] and then delete the space. Now press OK and the job is done.
Setting the Firewall
IIS serves the website on port 80. Therefore this port has to be open in order to be externally accessible. You could go to the Windows firewall and set the proper ports or you can simply turn the firewall off. As long as we are on a demo sandobx environment, this is the quickest acceptable way.
Last but not least – if you are running the Sitecore instance in a virtual machine, make sure to have the network set correctly. If you (like me) are using Virtualbox, you can set “Hosted Networking” for a local access from your physical host to the VM (does not need external networking) or you could set “Bridged Networking” for access on a network you are attached to – including any other machines connected to that network.
Running the Launchsitecore website
To connect to your Launchsitecore app, find out the IP address assigned to the server and just access that IP address from the web browser. There is no need of putting any host names in the Windows Hosts file, because we set the default binding to the Launchsitecore application.