Main Content

Use an Install Profile for Repetitive Drupal Install

Use an Install Profile for Repetitive Drupal Install

Have you ever found yourself doing the same installation process again and again? Maybe installing Drupal multiple times to create different projects, testing reviewing patches in Drupal, or testing new features in a fresh install?

You might want to look into creating an Install Profile. It can remove the repetitive tasks of downloading modules, installing and configuring variables.
 
Below I will show you how to create an Install Profile in 3 easy steps!
 
In overview, we will create 3 files: 
  • install_profile_name.info
  • install_profile_name.install
  • install_profile_name.profile
 
First, create a new folder in /drupal-core-folder/profiles. For this example, let’s call it demoprofile.
 
Then create the 3 files mentioned above. You should have the following files:
/profiles/demoprofile/ - demoprofile.info - demoprofile.install - demoprofile.profile
For my demoprofile, I want to use the standard installation and add 3 modules:
  • admin_menu
  • module_filter
  • git_deploy
I want to remove the modules below because I don't use them:
  • overlay
  • toolbar
So I simply copied content from standard.info to demoprofile.info. I removed the overlay and toolbar lines and added the following lines:
; Contrib dependencies[] = admin_menu dependencies[] = module_filter dependencies[] = git_deploy

 

Then in the demoprofile.install, I called it standard_install() since I don't need to modify anything.

/** * Implements hook_install(). * * Perform actions to set up the site for this profile. * * @see system_install() */ function standard_install() { include_once DRUPAL_ROOT . '/profiles/standard/standard.install'; standard_install(); }

 

Lastly, make sure to add the modules inside your directory. So my demoprofile folder has the following files now.

/profiles/demoprofile/ - demoprofile.info - demoprofile.install - demoprofile.profile - modules ---- admin_menu ---- git_deploy ---- module_filter

 

Once you open your Drupal install, you should see your Install Profile.

Select an Installation Profile
 
Here’s another resource for making an Install Profile:
 
This approach is also used when releasing a Distribution. There is another approach, using Drush and Drush make, and that will be tackled in a different article.