Installing Drupal using Drush Make

Let's say you want to deploy a new Drupal website, but you want to use a custom setup,  you could:

  1. Install a "vanilla" version of Drupal using sftp, wget, or Drush, and then install all your modules
  2. Use an installation profile
  3. Use Drush Make

Option #1 is a bad idea. Not only is it time consuming (even if you use Drush), but there's actually a bug in recent versions of Drupal 7 that can creep in when you install multiple modules at one time. The second option is a good idea except installation pages are large, take more effort to build, and more time to install. Generally speaking, a full installation profile is only a good idea if you have lots of custom options that you want to configure during installation. (See Panopoly.)

Option 3: Using Drush make

In some use cases the fastest and cleanest option is #3, to use 'Drush make'. Using 'Drush make', you can generate a "makefile": a small, clean description of the themes and modules that are installed on an existing site. The make file also tracks the version of each installed theme and module which will potentially save you from unexpected issues cause by installing a newer version of a particular module.

How to build a Drupal site with Drush Make

These instructions assume that you have shell or terminal access to your server and you already have the latest version of Drush installed.

1. Use an existing site to generate a Drush make file

Start by logging into your server and navigate to the root directory of the existing site which will be used to generate your Drush make "makefile".

ssh user@yourserver.com
cd /home/sitename/public_html

The directory path above is merely an example, you'll need to know the actual path to your drupal site.

2. Create the makefile

drush make-generate demo.make

This creates a Drush makefile called demo.make with all the installation info about your site. This is the most basic 'make' command, you can learn about more options for Drush make here: Drush documentation

3. Download the makefile

You can use your favorite sftp client, rsync, or cp through an ssh tunnel. Whatever works for you. In this case I'm just downloading it to my local environment so the "second server" is my laptop. The good news is that the makefile will be very small and easy to copy.

4. Run the makefile on the new server

Once you've copied (via sftp, rsync, cp, etc.) your make file into the root folder of where your site will eventually live, SSH into your new server and deploy your Drupal installation with the following command:

drush make demo.make

Drush will automatically download Drupal core and all your modules. As mentioned previously, Drush make keeps track of project versions so it will download the same versions you had on your old site. Alternatively, if you have nerves of steel, you can instruct the make command to download and install the latest versions instead, learn more here: Drush make options.

Hot tip: Make sure you've got the newest version of Drush before you run Drush make. Older versions of Drush don't unpack the makefile properly. You'll lose .htaccess, among other things.

5. Deploy your new site

Make sure you have a database for your new site. Then, point your browser to yoursite.com/install.php and run the installer. That's it!

Bonus: Additional features of Drush make command:

There are a few other things that you can do with Drush make, including:

Get a quick overview of your site:

Drush makefiles are written in plain English and are very easy to read. If you want a quick overview of the projects and configuration your site (or someone else's site), this is the way to go.

Migrate a site from one server to another:

Use drush make along with drush sql-sync and site aliases, and you've got an easy, fast, clean migration of Drupal from one server to another.