Skip to content

Configuring local development environment

Shivanshu Agrawal edited this page May 9, 2015 · 1 revision

Install drupal 7.36 via drush

  • Download drupal 7.36 using drush dl drupal --drupal-project-rename=drupal7

  • Install it by running the following command inside the drupal7 directory drush site-install standard --db-url='mysql://[username]:[password]@localhost/[database-name]' --site-name='[site name]' --account-name=[admin-username] --account-pass=[admin-password]

  • Use drush en [module-name] command to install all the required modules

  • Alternatively, use drush make with the following make file and then do a drush site-install

    ;full documentation for drush make file at http://www.drush.org/en/master/make/
    core = 7.x
    api = 2
    projects[drupal][version] = 7.36
    projects[] = views
    projects[] = coder

Install drupal-8.0.0-beta10 via drush

  • Download the specified version of drupal using drush dl drupal-8.0.0-beta10 --drupal-project-rename=drupal8

  • Install it in a manner similar to drupal 7

Setting up drush aliases

  • In the .drush directory in the home folder, put a file named [sitename].aliases.drushrc.php with the following content

    #Example aliases file at https://github.com/drush-ops/drush/blob/master/examples/example.aliases.drushrc.php
    <?php
    $aliases["d8"] = array (
      'root' => '/home/shivanshu/webapps/drupal8',
      'uri' => 'http://drupal8.localhost',
    );
    
    $aliases["d7"] = array (
      'root' => '/home/shivanshu/webapps/drupal7',
      'uri' => 'http://drupal7.localhost',
    );
    ?>
  • Now, the drush commands can be run from any directory in the following manner drush @d7 en [module-name]

  • To list all enabled modules, use drush @d7 pm-list --type=Module --status=enabled

Backing up and Restoring site using Drush

  • drush archive-dump will backup the website in an archive

  • drush archive-restore [path to archive] will restore the backed up archive in the folder where the command is run