Project

General

Profile

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

Jack Aponte, 05/28/2019 06:31 PM
Major overhaul since now only Drush 8 is needed

1 14 Jack Aponte
{{lastupdated_at}} by {{lastupdated_by}}
2
3 34 Jack Aponte
{{>toc}}
4
5 1 Jack Aponte
h1. Installing Drush for working with Drupal 6-8 and Backdrop
6
7 40 Jack Aponte
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.":http://docs.drush.org/en/master/install/#drupal-compatibility
8 9 Jack Aponte
9 40 Jack Aponte
h2. Installing and updating Drush 8 for all users
10 1 Jack Aponte
11 40 Jack Aponte
I've followed the "Install a global Drush via Composer" instructions under in the "Drush 8 alternative installation documentation.":http://docs.drush.org/en/8.x/install-alternative/
12 28 Jack Aponte
13 40 Jack Aponte
TODO: Update the instructions below to indicate that running @composer install@ as root is a "security risk":https://getcomposer.org/doc/faqs/how-to-install-untrusted-packages-safely.md, need to determine an alternative approach.
14 8 Jack Aponte
15 16 Jack Aponte
<pre>
16 40 Jack Aponte
sudo COMPOSER_HOME=/opt/drush COMPOSER_BIN_DIR=/usr/local/bin COMPOSER_VENDOR_DIR=/opt/drush/8 composer require drush/drush:8.2.3
17
cd /opt/drush/8/drush/drush/
18
sudo composer install
19 1 Jack Aponte
</pre>
20 30 Jack Aponte
21 40 Jack Aponte
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)
22 1 Jack Aponte
23 40 Jack Aponte
Use the same commands with a new version number to update Drush as needed.
24 1 Jack Aponte
25
h2. Install Drush on May First/People Link (MFPL) and other shared hosting environments
26
27
Primarily drawn from "this MFPL ticket;":https://support.mayfirst.org/ticket/11691#comment:3 thanks Ivan!
28 17 Jack Aponte
29 18 Jack Aponte
First, install Composer following "these instructions":https://getcomposer.org/download/.
30 17 Jack Aponte
31
Then to install Drush:
32
33
<pre>
34
echo 'export PATH="$HOME/.composer/vendor/bin:$PATH"' >> ~/.bashrc
35
source ~/.bashrc
36
cd ~/<organization.org>/bin
37 40 Jack Aponte
php composer.phar global require drush/drush:8.2.3
38 17 Jack Aponte
which drush
39 23 Jack Aponte
</pre>
40 25 Jack Aponte
41 40 Jack Aponte
Note that sometimes @cgi-bin@ is present on MF/PL sites instead of @bin@.
42 1 Jack Aponte
43 23 Jack Aponte
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:
44
45 19 Jack Aponte
<pre>
46 20 Jack Aponte
$aliases['organization'] = array(
47 19 Jack Aponte
  'remote-host' => 'organization.org',
48
  'remote-user' => 'organization',
49 20 Jack Aponte
  'root' => '/home/members/organization/sites/organization.org/web',
50
  'uri' => 'organization.org',
51
  'path-aliases' => array(
52
    '%drush-script' => '/home/members/organization/sites/organization.org/users/organization/.composer/vendor/bin/drush',
53 21 Jack Aponte
    '%dump-dir' => '~/drush-backups',
54 19 Jack Aponte
    '%files' => '/home/members/organization/sites/organization.org/web/sites/default/files',),
55 1 Jack Aponte
);
56
</pre>
57 8 Jack Aponte
58
h2. Install and update Drush Backdrop commands
59 1 Jack Aponte
60 8 Jack Aponte
In order for Drush to work with Backdrop, you must install the "Drush Backdrop commands":https://github.com/backdrop-contrib/drush within the Drush 8 installation itself.
61 1 Jack Aponte
62 40 Jack Aponte
Assuming that Drush 8 is installed in @/opt/drush/8/drush/drush@, as specified above:
63 1 Jack Aponte
64 10 Jack Aponte
<pre>
65 40 Jack Aponte
git clone https://github.com/backdrop-contrib/drush.git /opt/drush/8/drush/drush/commands/backdrop
66 10 Jack Aponte
</pre>
67
68 40 Jack Aponte
To update Drush Backdrop commands later, run @git pull origin@ from within the @drush/commands/backdrop@ directory.
Go to top