Installing Drush for working with Drupal 6-8 and Backdrop » History » Version 57
Jack Aponte, 01/20/2022 07:01 PM
Updated Drush version to 8.4.10
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 | 41 | Jack Aponte | Since running @composer install@ as root is a "security risk":https://getcomposer.org/doc/faqs/how-to-install-untrusted-packages-safely.md, you can use commands like these to install Drush in your home directory first, then move it to a globally-accessible location using @sudo@: |
14 | 8 | Jack Aponte | |
15 | 1 | Jack Aponte | <pre> |
16 | 44 | Jack Aponte | cd ~ |
17 | 57 | Jack Aponte | COMPOSER_HOME=$HOME/drush COMPOSER_VENDOR_DIR=$HOME/drush/8 composer require drush/drush:8.4.10 |
18 | 1 | Jack Aponte | cd ~/drush/8/drush/drush |
19 | 41 | Jack Aponte | composer install |
20 | 47 | Jack Aponte | cd ~ |
21 | 44 | Jack Aponte | sudo mv ~/drush /opt/ |
22 | 47 | Jack Aponte | sudo chown -R root: /opt/drush |
23 | 54 | Jack Aponte | sudo ln -s /opt/drush/8/drush/drush/drush /usr/local/bin/drush |
24 | 1 | Jack Aponte | </pre> |
25 | |||
26 | 57 | Jack Aponte | Replace "8.4.10" (last updated in this documentation on 01/20/2022) with the tag of the most recent stable 8.x release (see https://github.com/drush-ops/drush/releases) |
27 | 56 | Jack Aponte | |
28 | 43 | Jack Aponte | If you _must_ run @composer install@ and the other commands above as root, e.g. if that's the only user we have access to on the server, you can do so by changing the @COMPOSER_HOME@ path to @/opt/drush@ and @COMPOSER_VENDOR_DIR@ to @/opt/drush/8@ and adjusting the other commands above accordingly. |
29 | 52 | Jack Aponte | |
30 | 1 | Jack Aponte | |
31 | 40 | Jack Aponte | Use the same commands with a new version number to update Drush as needed. |
32 | 1 | Jack Aponte | |
33 | 50 | Jack Aponte | h2. Install and update Drush Backdrop commands |
34 | |||
35 | 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. |
||
36 | |||
37 | Assuming that Drush 8 is installed in @/opt/drush/8/drush/drush@, as specified above: |
||
38 | |||
39 | <pre> |
||
40 | sudo git clone https://github.com/backdrop-contrib/drush.git /opt/drush/8/drush/drush/commands/backdrop |
||
41 | </pre> |
||
42 | |||
43 | To update Drush Backdrop commands installed like this: |
||
44 | |||
45 | <pre> |
||
46 | cd /opt/drush/8/drush/drush/commands/backdrop |
||
47 | 1 | Jack Aponte | sudo git pull origin |
48 | </pre> |
||
49 | 50 | Jack Aponte | |
50 | 56 | Jack Aponte | h2. Install Drush on May First Movement Technology and other shared hosting environments |
51 | 1 | Jack Aponte | |
52 | 56 | Jack Aponte | Primarily drawn from "this MF ticket;":https://support.mayfirst.org/ticket/11691#comment:3 thanks Ivan! |
53 | 17 | Jack Aponte | |
54 | 18 | Jack Aponte | First, install Composer following "these instructions":https://getcomposer.org/download/. |
55 | 17 | Jack Aponte | |
56 | Then to install Drush: |
||
57 | 1 | Jack Aponte | |
58 | 17 | Jack Aponte | <pre> |
59 | echo 'export PATH="$HOME/.composer/vendor/bin:$PATH"' >> ~/.bashrc |
||
60 | source ~/.bashrc |
||
61 | cd ~/<organization.org>/bin |
||
62 | 57 | Jack Aponte | composer global require drush/drush:8.4.10 |
63 | 17 | Jack Aponte | which drush |
64 | 1 | Jack Aponte | </pre> |
65 | 8 | Jack Aponte | |
66 | Note that sometimes @cgi-bin@ is present on MF/PL sites instead of @bin@. |
||
67 | 1 | Jack Aponte | |
68 | 8 | 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: |
69 | 1 | Jack Aponte | |
70 | 40 | Jack Aponte | <pre> |
71 | 1 | Jack Aponte | $aliases['organization'] = array( |
72 | 10 | Jack Aponte | 'remote-host' => 'organization.org', |
73 | 42 | Jack Aponte | 'remote-user' => 'organization', |
74 | 10 | Jack Aponte | 'root' => '/home/members/organization/sites/organization.org/web', |
75 | 'uri' => 'organization.org', |
||
76 | 45 | Jack Aponte | 'path-aliases' => array( |
77 | '%drush-script' => '/home/members/organization/sites/organization.org/users/organization/.composer/vendor/bin/drush', |
||
78 | '%dump-dir' => '~/drush-backups', |
||
79 | '%files' => '/home/members/organization/sites/organization.org/web/sites/default/files',), |
||
80 | ); |
||
81 | </pre> |