Switching Installation Profiles on Existing Drupal Sites
In my last blog post I outlined how to use per project installation profiles. If you read that post and want to use installation profiles to take advantage of site wide content changes and centralised dependency management, this post will show you how to do it quickly and easily.
The easiest way to switch installation profiles is using the command line with drush. The following command will do it for you:
$ drush vset --exact -y install_profile my_profile
An alternative way of doing this is by directly manipulating the database. You can run the following SQL on your Drupal database to switch installation profiles:
UPDATE variable SET value = 'my_profile' WHERE name = 'install_profile'; -- Clear the cache using MySQL only syntax, when DB caching is used. TRUNCATE cache;
Before you switch installation profiles, you should check that you have all the required modules enabled in your site. If you don't have all of the modules required by the new installation profile enabled in your site, your are likely to have issues. The best way to ensure you have all the dependencies enabled is to run the following one liner:
drush en $(grep dependencies /path/to/my-site/profiles/my_profile/my_profile.info | sed -n 's/dependencies\[\]=\(.*\)/\1/p')
Even though it is pretty easy to switch installation profiles I would recommend starting your project with a project specific installation profile.
Edit: Jaime Schmidt picked up a missing step in the instructions above. You need to enable the installation profile in the system table. The easiest way to do that is with this drush one liner:
echo UPDATE system SET schema_version = 0 WHERE name = 'my_profile' | drush sqlc && drush cc all
Further Edit: Marji Cermak picked up a typo in the dependencies one liner. It is one word I use a lot and always misspell.