Create 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
1. Create a New Folder
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
2. Copy Content to the demoprofile.info.
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(); }
3. Add Your Modules
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.
Here’s another resource for making an Install Profile: How to Write a Drupal 7 Installation 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.
Other Insights & Resources you may like
Get our newsletter
Get weekly Drupal and AI technology advancement news, pro tips, ideas, insights, and more.