Drupal 7 Installation Profiles

By: Jim Applebee / 2017-03-17

Do you find yourself using the same basic module configuration on most of the Drupal sites you build? If so, creating and using a Drupal installation profile will save you a tremendous amount of time. 

drupal 7 installation profile

Manually loading Drupal core followed by necessary modules and then configuring each one is a tedious, time-consuming job. Using an installation profile allows you to skip over the early stages of a site’s development giving you a starting point that is farther along in the process.

What is an Installation Profile?

An installation profile is an often-used collection of Drupal modules and themes that are bundled with Drupal core. You can find popular installation profiles and distributions at Drupal.org. (https://www.drupal.org/project/project_distribution) They will help you quickly launch ecommerce, publishing, restaurant, and many other types of sites. If you do not see an installation profile that suits your needs, you can build your own.

commerce_kickstart

Like most things in Drupal – there is more than one way to create an installation profile. If you like to write code, then building an installation profile by hand might be a fun challenge. (https://www.drupal.org/node/1022020) However, a profile for a sophisticated site might require a thousand lines of code or more. If your goal is to save time, let the Profiler library (https://www.drupal.org/project/profiler) and Profiler Builder (https://www.drupal.org/project/profiler_builder) module do the heavy lifting,

Profiler and Profiler Builder together will create an installation profile from an existing site and deliver a downloadable tar package. You’ve already put time into building the site, why not make the next step as simple as possible? The end result will be a .info, .profile, .install, .make, and .make.example files that are well structured and ready to use.

Getting Started

Go to profiles folder in your drupal installation and create a folder of your choice

drupal7_profile_select

Install the Profiler library in profiles/your current profile/libraries/profiler. Profiler Builder goes into your contributed modules folder.

Install the profile builder module into the drupal you wish to create multiples of

drupal_7_profile_builder

 

Next Steps

.info File

After installing Profiler and Profiler Builder, visit Configuration>Development>Profiler Builder. The first part of the form requests information that will populate the .info file.

druapl7_profile

•                Profile name – the module picks up the site name, but you can change that to something more descriptive.

•                Description – If you plan to submit this profile at Drupal.org, it will be important to make the description detailed enough so that others will understand its purpose.

•                Exclusive – Do you want to skip the profile selection window during installation? If so, check this box.

•                Include Profiler – Do you wish to include Profiler in your installation profile? If so, check the box and then check whether you want to also include dependencies and/or variables.

.install File

drupal7_post_install

The second box offers two options for the .install file. After modules are installed, do you want to:

•                Create an admin role – this is recommended

•                Create defaults like those that are created with the standard profile?

.make File

The final box on the page holds a list of libraries and patches that are checked by default. You can uncheck the box if you do not want the library to be included in the installation profile. If you plan to keep the install profile for private use, you are safe to include the libraries. If you want to make the profile available for others to use, there may be copyright issues with some of the libraries. If this is the case, your profile cannot be hosted at Drupal.org.

Drupal_7_drush

Once you have your packaged profile, you are able to use it repeatedly to quickly spin up Drupal sites that suit a specific need or that simply have your favorite module configuration.

Using an Installation Profile

Installation profiles can only be used on fresh installs of Drupal. To get started, have the current version of Drupal handy, prepare a database, and create a settings.php file. Do not initiate the installation script.

Unpack the installation profile you just downloaded using the Profiler Builder module and place the entire directory in the Profiles directory found in Drupal root.

Place all required modules in sites/all/modules and all required themes in sites/all themes. The installation of modules and themes will also work if they are placed in sites/all/profiles/mynewprofile/modules and sites/all/profiles/mynewprofile/themes.

Now, it is time to install Drupal by visiting your site’s install.php. On the screen where you are typically prompted to select between the minimal and standard installation profiles, you will now be presented with your new installation profile as a third option. 

Drupal_7_select_profile

Select your custom installation profile and let Drupal do the rest of the work for you.