Project

General

Profile

Actions

Installing Drush for working with Drupal 6-8 and Backdrop » History » Revision 40

« Previous | Revision 40/62 (diff) | Next »
Jack Aponte, 05/28/2019 06:31 PM
Major overhaul since now only Drush 8 is needed


Updated almost 5 years ago by Jack Aponte

Installing Drush for working with Drupal 6-8 and Backdrop

An important note: we no longer need to install any version of Drush except Drush 8, since that now supports Drupal 6, 7, <8.3 and Backdrop.

Installing and updating Drush 8 for all users

I've followed the "Install a global Drush via Composer" instructions under in the Drush 8 alternative installation documentation.

TODO: Update the instructions below to indicate that running composer install as root is a security risk, need to determine an alternative approach.

sudo COMPOSER_HOME=/opt/drush COMPOSER_BIN_DIR=/usr/local/bin COMPOSER_VENDOR_DIR=/opt/drush/8 composer require drush/drush:8.2.3
cd /opt/drush/8/drush/drush/
sudo composer install

Replace "8.2.3" (last updated in this documentation on 5/28/19) with the tag of the most recent stable 8.x release (see https://github.com/drush-ops/drush/releases)

Use the same commands with a new version number to update Drush as needed.

Install Drush on May First/People Link (MFPL) and other shared hosting environments

Primarily drawn from this MFPL ticket; thanks Ivan!

First, install Composer following these instructions.

Then to install Drush:

echo 'export PATH="$HOME/.composer/vendor/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
cd ~/<organization.org>/bin
php composer.phar global require drush/drush:8.2.3
which drush

Note that sometimes cgi-bin is present on MF/PL sites instead of bin.

If using Drush aliases, you may need to specify the new Drush installation in the shared aliases.drushrc.php file or a local aliases file. Here's an example:

$aliases['organization'] = array(
  'remote-host' => 'organization.org',
  'remote-user' => 'organization',
  'root' => '/home/members/organization/sites/organization.org/web',
  'uri' => 'organization.org',
  'path-aliases' => array(
    '%drush-script' => '/home/members/organization/sites/organization.org/users/organization/.composer/vendor/bin/drush',
    '%dump-dir' => '~/drush-backups',
    '%files' => '/home/members/organization/sites/organization.org/web/sites/default/files',),
);

Install and update Drush Backdrop commands

In order for Drush to work with Backdrop, you must install the Drush Backdrop commands within the Drush 8 installation itself.

Assuming that Drush 8 is installed in /opt/drush/8/drush/drush, as specified above:

git clone https://github.com/backdrop-contrib/drush.git /opt/drush/8/drush/drush/commands/backdrop

To update Drush Backdrop commands later, run git pull origin from within the drush/commands/backdrop directory.

Updated by Jack Aponte almost 5 years ago · 40 revisions

Also available in: PDF HTML TXT

Go to top