Speed Up Your Drupal Development Using Installations and Distributions
Do you find yourself repeating the same steps whenever you start a new Drupal project? Do you always download and enable the same modules, and make the same configuration changes every time? As we start doing more and more Drupal projects at Nomensa, I noticed that we were doing exactly this, so I started to look into ways to streamline our initial project setup process. My solution was to create my own custom installation profile that provides me with a template to start each project, and this article outlines the steps I took to create it. The code outlined in this article has been committed into GitHub at https://github.com/opdavies/linuxjournal_demo, and it's available for you to download and re-use as needed.
What Are Installation Profiles?
Installation profiles are a combination of modules and themes and predefined configuration. A great example of an installation profile that I use regularly is called Commerce Kickstart (http://drupal.org/project/commerce_kickstart). It provides a version of Drupal 7 along with the Drupal Commerce suite of modules that have been preconfigured to have the correct content types, rules, views and so on. Once an installation profile has been uploaded onto drupal.org as a project, it gets bundled with Drupal core, is available as a packaged download, and is known as a distribution. See http://drupal.org/project/distributions for a list of existing distributions.
Figure 1. The Commerce Kickstart Project Page
How to Install an Existing Installation Profile
There are two different ways to download an existing Drupal
installation profile. The first (and easiest) method is to download it
as a distribution from drupal.org. To do this, go to the project page
for the installation profile (for example,
http://drupal.org/project/commerce_kickstart), scroll to the bottom of
the page, and download a release in the same way that you would
download a module or theme. The resulting file will be named something
like commerce_kickstart-7.x-1.10-core.tar.gz, and this file will contain
both
Drupal core and the Commerce Kickstart installation profile. The other
option is to download a fresh copy of Drupal core, and then
download the installation profile seperately, either using a drush
command like drush dl commerce_kickstart, or clone it directly from
its Git repository, and then place it within the Drupal's profiles
directory.
Now, when you go to install Drupal, there is an additional option to use the Commerce Kickstart installation profile. Select the appropriate profile, click the Save and continue button, and continue through the installation process as normal.
Figure 2. The Installation Screen with Commerce Kickstart
How to Start Creating Your Own Installation Profile
Outside your Drupal directory, create a new directory to hold the files for your installation profile. Mine is called linuxjournal_profile, although the name of the profile is going to be simply linuxjournal. I've appended _profile to the end of the directory name. Later, there will be several different directories with similar names, so this helps provide some clarity. Be sure to give some thought to the name beforehand and ensure that it doesn't conflict with any potential modules or themes.
The first file I need to create is the linuxjournal.info file that, identical to .info files for modules and themes, defines the name and description of the profile, as well as which version of Drupal core that it is compatible with. I'm also going to make it dependent on the core dblog and block modules so that these are enabled automatically when the profile is installed:
name = Linux Journal
description = A demonstration installation profile for my LJ article.
core = 7.x
dependencies[] = dblog
dependencies[] = block
The only other mandatory file needed for this profile to be visible to Drupal is the .profile file—in this case, linuxjournal.profile. Within this file, I can put any custom PHP functions or implementations of Drupal hooks that will take effect during the installation process. For now, I'm just going to add an opening PHP tag and leave the rest of the file blank. To confirm that everything works okay so far, I can download a fresh copy of Drupal core, copy linuxjournal_profile into the profiles directory, rename it to linuxjournal so that it is the same as the name of the profile, and load that site in a Web browser.
Figure 3. The Install Screen with the Linux Journal Installation Profile
So far, so good. On the installation page, as well as seeing the default Standard and Minimal profiles, I also can see my Linux Journal profile. I can select this and continue with the installation process as normal to confirm that it's working, although because I've not entered anything into linuxjournal.profile yet, nothing special is going to happen.
Adding a .install File
Identical to writing a module, I can create a .install file that contains functions to run when the profile is installed, updated or uninstalled. I'm going to utilize the hook_install() function from the minimal installation profile as part of my profile instead of re-declaring its contents myself and duplicating code. Within my own implementation of hook_install(), I can include the .install file from the minimal profile and then run its minimal_install() function:
<?php
/**
* @file
* Install, update and uninstall functions
* for the Linux Journal installation profile.
*/
/**
* Implements hook_install().
*
* Run the hook_install() function from the minimal
* profile as part of this profile.
*/
function linuxjournal_install() {
// Utilize the hook_install() implementation from
// the minimal profile.
include_once DRUPAL_ROOT . '/profiles/minimal/minimal.install';
minimal_install();
}
Adding Modules
I'm now going to create another file called linuxjournal.make. This file contains a listing of all the projects (modules and themes) and libraries that are used within the profile. My company specializes in building accessible Web sites, and I use a number of contributed modules on every site to help me do this. There are also some essential contributed modules, such as Administration Menu (http://drupal.org/project/admin_menu) and Pathauto (http://drupal.org/project/pathauto), as well as some custom modules and features that I use on every site. All of these will be listed within the linuxjournal.make file.
Oliver Davies is an Application Developer at Nomensa, specializing in Drupal and PHP development. Outside work, Oliver is a keen contributor to the Drupal community—attending local user groups and maintaining several of his own contributed modules.
Today’s modular x86 servers are compute-centric, designed as a least common denominator to support a wide range of IT workloads. Those generic, virtualized IT workloads have much different resource optimization requirements than hyperscale and cloud applications. They have resulted in a “one size fits all” enterprise IT architecture that is not optimized for a specific set of IT workloads, and especially not emerging hyperscale workloads, such as web applications, big data, and object storage. In this report, you will learn how shifting the focus from traditional compute-centric IT architectures to an innovative disaggregated fabric-based architecture can optimize and scale your data center.
Sponsored by AMD
Built-in forensics, incident response, and security with Red Hat Enterprise Linux 6
Every security policy provides guidance and requirements for ensuring adequate protection of information and data, as well as high-level technical and administrative security requirements for a system in a given environment. Traditionally, providing security for a system focuses on the confidentiality of the information on it. However, protecting the data integrity and system and data availability is just as important. For example, when processing United States intelligence information, there are three attributes that require protection: confidentiality, integrity, and availability.
Learn more about catching the bad guy in this free white paper.
Sponsored by DLT Solutions
Web Development News
Developer Poll
| Making Linux and Android Get Along (It's Not as Hard as It Sounds) | May 16, 2013 |
| Drupal Is a Framework: Why Everyone Needs to Understand This | May 15, 2013 |
| Home, My Backup Data Center | May 13, 2013 |
| Non-Linux FOSS: Seashore | May 10, 2013 |
| Trying to Tame the Tablet | May 08, 2013 |
| Dart: a New Web Programming Experience | May 07, 2013 |
- New Products
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- Drupal Is a Framework: Why Everyone Needs to Understand This
- A Topic for Discussion - Open Source Feature-Richness?
- Home, My Backup Data Center
- RSS Feeds
- New Products
- Trying to Tame the Tablet
- What's the tweeting protocol?
- Dart: a New Web Programming Experience
- Hey God - You may not be
25 min 5 sec ago - Reply to comment | Linux Journal
2 hours 57 min ago - Drupal is an Awesome CMS and a Crappy development framework
7 hours 36 min ago - IT industry leaders
9 hours 59 min ago - Reply to comment | Linux Journal
1 day 2 hours ago - Reply to comment | Linux Journal
1 day 5 hours ago - Reply to comment | Linux Journal
1 day 6 hours ago - great post
1 day 7 hours ago - Google Docs
1 day 7 hours ago - Reply to comment | Linux Journal
1 day 12 hours ago







Comments
thanks for the information,
thanks for the information, this article really helped me in performing their duties. this my blog resep ayam
Reply to comment | Linux Journal
cellport clinic bangkok
Feel free to visit my weblog ... cell port thailand
Reply to comment | Linux Journal
Potong Pasir MRT at the doorstep, residents can easily access almost to any destination
through.d'leedon
thanks for the information,
thanks for the information, this article really helped me in performing their duties. this my blog resep ayam
The difference between install profiles and distros
Thanks for the article. A quick note about the title: I think you meant to say "Installation Profiles" instead of "Installations".
Your article is mainly about creating installation profiles and not so much about distributions. That's okay, because installation profiles are great and they can indeed speed up your development process.
IMHO it's too easy to say that "distributions are install profiles on drupal.org" and be done with it. The big difference is that if you use a distribution, you're no longer the maintainer of that code. That has some advantages like the availability of support and updates. The disadvantage is, that if you want to change the way a distribution works, you cannot simply go in and change the code. If you did that, it would get much harder to get support and install updates. In my experience, a distribution can dramatically speed up your development process if it is exactly (or very close to) what you need. If you are planning to make a lot of changes, building on a distribution may even slow down your development process. This is especially true for distributions with lots of features and styling, such as Open Atrium.
Features / Exportables
Nice article, Features, Profiler and Profiler Builder modules would all help in making a more complete export and install package (and faster) :)
Post new comment