Drupal allow you to set up installation profiles to fast-track creating a website. Rather than starting from scratch each time you create a site, you can select an install profile that does some initial configuration for you. This is super useful if you make a lot of websites that start the same way. I think multilingual websites are a good example, since there's a lot of configuration that gets repeated.
You’ve used an installation profile if you’ve ever installed a Drupal site. There are two that come with Drupal core: minimal and standard. The minimal install profile doesn't come with much, but the standard one adds a couple content types (articles, basic pages) a user role (administrator), places some blocks in various regions, and sets up text formats as well as a few other things.
Taking the standard install as a model, you can see how it's possible to create your own install profile to automate some configuration of your site.
Automating site configuration with a script
Of course there are other ways to automate this process: you could create a post-install script that runs after the installation of Drupal. If you're familiar with Drush, you'll know that you can do a lot of site configuration using drush commands. However, there are limitations.
It's easy to set a variable using Drush, but adding a content type is another matter. To add a content type with Drush, you'd probably create a Feature using the features module and then enable it with Drush. This is fine if you want everything in Features, but since it's hard to 'de-featurize' content types later on, you might be looking for another approach.
Another drawback with a script is that it's harder for site builders to interact with. With an install profile, you can include forms that the user fills out during the install process to determine settings for the installation.
Architecture of an install profile
If you take the install profile route, you can take a look at the standard install profile as a starting point. The install profile I made as a sample can be found on GitHub here: Drupal Multilingual Starterkit. It contains three main files: multilingual_starterkit.info, multilingual_starterkit.install, and multilingual_starterkit.profile. Here's how you can use the three files:
This looks just like a module or theme .info file. It lists the dependencies of the profile - modules that will be installed when the install profile runs.
name = Multilingual Startkerkit description = Profile for setting up a multilingual website. core = 7.x version = 0.1 ;Core Dependencies dependencies = block dependencies = color dependencies = comment
In this file, you can implement
hook_install(). It allows you to set up the initial configuration for your install profile: set variables, add content types, blocks, and text formats.
This is where you can define install tasks for the installation profile. Each task can be a step in the install process, where you can collect information from the user installing Drupal.
You define the tasks by implement
hook_install_tasks() and returning an array of steps for the installer. Each step corresponds to a callback function (which could be a form that collects settings from the user). Other examples of tasks would be importing the translations for the selected languages, or adding sample content.
You can also use
hook_install_tasks_alter() in the .profile file to unset steps from the default install process.
Adding Make Files
If you want to make your install profile really fancy, you can add .make files. Make files indicate where to download everything from to set up your site. So you can start with just the make files and end up with a fully functioning site. You should create two make files for your install profile:
As the name suggests, this file indicates what to download from Drupal.org, and specifically which versions to download.
core = 7.x api = 2 projects[drupal][version] = "7.31" projects[views_bulk_operations][version] = "3.2" projects[views_bulk_operations][subdir] = "contrib" projects[admin_menu][version] = "3.0-rc4" projects[admin_menu][subdir] = "contrib" projects[admin_views][version] = "1.3" projects[admin_views][subdir] = "contrib" projects[ctools][version] = "1.4" projects[ctools][subdir] = "contrib"
You'll also need a .make file for your install profile. This will download the install profile and any custom modules that you have created for it. As you can see in this example, you can include your drupal-org-core.make file in this file.
api = 2 core = 7.x ; Include the definition for how to build Drupal core directly includes = drupal-org-core.make ;Multilingual Starterkit Install Profile projects[multilingual_starterkit][download][type] = "git" projects[multilingual_starterkit][download][url] = "https://github.com/pixelite/drupal-multilingual-starterkit" projects[multilingual_starterkit][download][branch] = "master" projects[multilingual_starterkit][type] = "profile"
Now, all you'll need to run is
drush make build-multilingual-starterkit.make and the files for your site will be downloaded and ready to install.
This blog post came out of a presentation from DrupalCamp Montreal 2014. You can find the slides for the presentation here.