Installation profiles - automating basic site configuration to speed up development

Often when I am building a new Drupal site I click through a number of the same pages changing a number of common settings.  Creating a custom Install Profile will allow us to expand on or change the basic settings of the site. Here is the definition of an install profile from

Installation profiles provide site features and functions for a specific type of site as a single download containing Drupal core, contributed modules, themes, and pre-defined configuration. They make it possible to quickly set up a complex, use-specific site in fewer steps than if installing and configuring elements individually.

An installation profile is used only for the initial installation of a Drupal site. When the installer runs some site settings and configurations are set. You may create a number of different installation profiles and use different ones based on the type of project you are working on. I have learned much about installation profiles by looking at the excellent work being done by others, specifically the Open Atrium install profile and the Drupal Commons install profile(you will need to download the package to see the files as there is no publicly visible repository).

Install profiles live in the “profiles” directory of the Drupal root. When you are installing Drupal and have a custom profile in the “profiles” directory Drupal will prompt you which profile you would like to install. In our case the install screen looks like:

custom installer

Next you simply click on the profile and proceed with installation as you normally would. Installation profiles can be simple or very complex. To see some very complex functionality check out the two resources mentioned above. To make an install profile you simply need to have a directory in “profiles” with a file in it with a .profile extension.

We will continue building the artist site we started in the last post about Drush Make.

We will have a directory named “art” in the "profiles" directory and inside of it will be a file named “art.profile”. Having the same name for the directory and file is important, make sure they are the same. We are also going to have a few other files in the directory as well and I will point those out as we go.

You can download the source here and follow along.

You could also clone it from my github at


Your directory should look like:

I am going to look at the code in an install profile and paste bits of it below. The file is made up of a number of functions that we will look at. I am going to use the files from the art example we constructed with our make file, so I have replaced the hookname with my hookname which is “art”. If that does not mean anything to you don’t worry, just read on.

I am not a code ninja and I have put this profile together after reading and re-reading the profiles mentioned above so I can vouch that even if you are not a programmer you can follow along with most of this. I am not going to go into every details about every bit of this profile, but I will hit the high points and let you sort through the (well commented) code yourself. If you are having a bit of blog fatigue at this point I will let you in on part of the end of this story-> you end up with a fully configured WYSIWYG in your Drupal site! If that does not get a Drupal site builder who has set that up a bunch of times excited then I don’t know what will.

(code from art.profile coming up)

First is


This is a list of the modules to enable. Here is the function from our example:

function art_profile_modules() {
 $modules = array(
    // Default Drupal modules.
    'help', 'menu', 'dblog', 'path',

    // Chaos Tools
    'ctools', 'context', 'context_ui',

    // Views
    'views', 'views_ui', 'views_content',

    // CCK
    'content', 'content_permissions', 'fieldgroup', 'text', 'filefield', 'imagefield',
    'optionwidgets', 'link', 'filefield_meta', 'nodereference',

    // Date
    'date_api', 'date_timezone', 'date',  'date_popup', 'date_tools',

    // ImageAPI + ImageCache
    'imageapi', 'imagecache', 'imageapi_gd', 'imagecache_ui',

    // Rules
    'token', 'rules', 'rules_admin',

    // Editor
    'wysiwyg', 'better_formats',

    // Install Profile
    'install_profile_api', 'node_export',

    // Misc
    'admin_menu', 'auto_nodetitle', 'backup_migrate', 'formfilter', 'imce', 'imce_wysiwyg', 'jquery_update', 'login_destination', 'menutrails', 'jquery_ui', 'path_redirect', 'semanticviews', 'views_bulk_operations', 'diff', 'pathauto', 'vertical_tabs',

    // Strongarm

    // Features


 return $modules;

This list matches the list in our make file. If you put something on this list that is not in the modules directory the installer will complain, so make sure you have the modules before you run the installer. You might see “install_profile_api” on that list and wonder what that is for. The Install Profile API is a helper module that gives us some extra functionality in our install profile, more on that in a minute.

Next up is

function art_profile_details() {

 return array(
    'name' => 'Art Website',
    'description' => 'Artist Website.'

This function is where we specify the text to display when Drupal offers us the different installer options. If you want to be fancy here you can check out the Drupal Commons install profile linked above for an example of how to add an image to your profile description.

Next up is


Here we can set the site name to use during installation.

Next up is

art_profile_tasks(&$task, $url)

This function handles quite a bit of lifting. In the beginning of the function we have:

// Include the enabled modules

this line is given to us in the Install Profile API README.txt file that tells us if we add it here we can have more options and it is directly followed by:

// Use the file to make a node
 install_node_export_import_from_file('profiles/art/content/', array('status'=>1), $user, FALSE);

This function we are calling (install_node_export_import_from_file) is in the Install Profile API module and allows us to import nodes that we have previously exported to a text file using the Node Export module. I really like this because I like my starter site to come pre-loaded with a few pages of dummy content. The file listed in the function above (living at profiles/art/content/ creates 3 nodes of the type page. A hat tip to this blog post for the inspiration. Next in this function we start in on some tasks. First we create a content type, this is a type of page lifted directly from the default install profile. Following this we set site variables like the footer message, turn off the logo, set the frontpage to node/1 which we created by importing the nodes above, and disable promoting and comments on the page type. Cool stuff.

Next up is


In this function we will set up some primary links for our navigation.

Next up is


In this function we define some input formats.

Next up is


In this function we hook up some WYSIWYG love! We are also using settings from the file in our profiles/art directory.

Next up is


In this function we can define roles.

Next up is


In this function we assign permissions. We are also using settings from the file in our profiles/art directory.

Next up is


In this function we change some theme settings like enabling a different theme and admin theme and disabling Garland.

Next up is


In this function we can assign some variables. We disable user registration and turn off error reporting(we still have the log of course). Lastly we run through some cleanup tasks and run one more function to help with setting the date and time. Whew.

That is kinda a lot. As I mentioned before, I am not a code ninja but I am learning.  This is an installation profile for Drupal 6 and from what I understand writing an installation profile for Drupal 7 has improved.  There is also an interesting project called Profiler that aims to make creating install profiles easier and quicker.

One final note on Installation Profiles.  You may be wondering if this is an example of a site for an artist why I do not go ahead and create content types for likely needed content types when I create my page content type in the installation profile, things like a type for portfolio items or a portfolio gallery.  This is an important question.  When you are planning a site it is important to identify the different functionality you will need and decide how to implement that functionality the best way.  An installation profile is not the proper place to create those content types.  Those content types will be tied to permission and likely to roles and dependant modules.  The proper way to add that functionality is through features.  Sometimes the lines between what to do in an installation profile and what to use features for can be a bit blurry and to help with making those decisions I recommend referring to the Kit Specification.  The Kit spec can help you determine the appropriate place to set certain permission and configuration so that you have the most sustainable code.

Please take the example code from this post and easily modify it to serve your needs and speed up your development process. 

If you see something that is not right above please leave a comment.

Here is a video showing the payoff.

See video