An installation profile is a tailored package which makes it possible for the user to set up complex sites using relatively fewer steps. An installation profile, let's say for news sites, will include features and modules for user registration, news submission, forums, everything that a news website need. Here, you can clearly see the convenience an installation profile would provide.
Let's see how we can write an installation profile. It is mandatory for a Drupal installation profile to include a profilename.info.yml and may also include the below-listed files or folders:
profilename.profile
profilename.install file
config folder
translations folder
As an example, we will be following the standard installation provided with vanilla Drupal.
Vanilla Drupal includes two installation profiles viz.,
Standard
Minimal
Both of these profiles come bundled with various modules to satisfy different user requirements. However, it does not guarantee that the default installation will solve each and every user's needs. Yes, a user can install modules to solve compatibility issues but picking individual modules from among 38000+ modules is going to be tedious and if he/she is a newbie then things will get chaotic.
The standard.info.yml (profilename.info.yml) file should follow the structure as below:
The standard.info.yml file.
Provide a suitable name as because profiles are like modules and need to constitute valid PHP function name.
Example, if the profile is for Acme starter kit valid profile machine names would be
acme_starter_kit
acme_starter
acme_starter_profile
acme_kit
The following would be invalid
acme-starter-kit
acme-kit
The dependencies and theme section contains the modules and themes that would be installed in the standard profile is chosen.
>>standard.install (profilename.install)
This file defines the permission of the administrator, placement of the contact link, default permissions for users, creates shortcuts, nodes etc.
A specimen of the standard profile has been displayed below.
This file is used to create hierarchical menu links. Additional custom links can also be added.
After successful completion of the above steps, we shift our attention to the Config Folder where we can copy contents from an already installed profile and pasting it in the config/install folder of our profile.
Now, we navigate to <project-root>/core/config and copy all the themes and modules listed in the core.extension.yml onto our profile's info file. Do note that the themes listed will be installed but none will be activated by default. To do so we need to copy system.theme.yml and paste it in <project-root>\core\profiles\standard\config\install
Highlighted system.theme.yml file.
Next, we need to remove all UUIDs (Universally Unique Identifier) and default_config_hash to avoid conflicts. It can be easily executed using command lines as mentioned below.
For Windows:
find /path/to/PROFILE_NAME/config/install/ -type f -exec sed -i -e '/^uuid: /d' {} \;
find /path/to/PROFILE_NAME/config/install/ -type f -exec sed -i -e '/_core/,+1d' {} \;
For Mac OSX:
find /path/to/PROFILE_NAME/config/install/ -type f -exec sed -i '' '/^uuid: /d' {} \;
find /path/to/PROFILE_NAME/config/install/ -type f -exec sed -i '' '/_core/{N;d;}' {} \;
>>Translations Folder:
This folder would contain all the translation options for the profile which can be included by having a file as such:
drupal/de/drupal-8.0..de.po
Now that we have all the necessary files, let's look at how we can package it into a Drupal.org-specific file
>>Drush Make File:
Drush make basically creates a drush-org.make file which contains all the latest releases of all modules/themes included in the profile.
$/drush generate-makefile drupal-org.make
>>Verify drush-org.make file :
Required module https://www.drupal.org/project/drupalorg_drush.
Verifying the make file is important to check if it is Drupal.org-compatible by typing in the following Drush command.
drush verify-makefile
A successful operation would return the following:
However, errors might occur and to proceed to the next step, all errors detected in this process needs to be neutralized.
The link below lists some common errors and their solutions.
https://www.drupal.org/node/1432190
Following the steps above we can create an installation profile fit to suit our requirements and chill out while the profile installs itself on our system without worrying about the need to install modules, dependencies etc.
A BIG SHOUT OUT to the bloggers and evangelists willing to impart their knowledge with their writing.
Share your experience and opinion with us and let the world be the stage to your ideas and work. Share your piece with us at [email protected]. We also welcome ideas in the planning phase.
What Do We Expect?
The content should align with our interest in web development and open source technology. However we are open to topics from in and around the industry.
An average blog post should be of around 1000 words, but this is of course subjective.
We love crazy and colourful content. Feel free to link awesome pictures, infographics, stats, and all.
We are also open to articles with cool tips and tricks, some How-to and step by step guide as well