Installing Drush for working with Drupal 6-8 and Backdrop » History » Version 60
Jack Aponte, 01/21/2022 07:54 PM
even more fixes to the commands for updates and composer and all
1 | 14 | Jack Aponte | {{lastupdated_at}} by {{lastupdated_by}} |
---|---|---|---|
2 | |||
3 | 34 | Jack Aponte | {{>toc}} |
4 | |||
5 | 59 | Jack Aponte | h1. Installing and Updating Drush |
6 | 1 | Jack Aponte | |
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 | 59 | Jack Aponte | These instructions follow 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 | 60 | Jack Aponte | If needed, follow "this Composer documentation":https://getcomposer.org/download/ to install or update Composer on the server. |
14 | |||
15 | 59 | 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 or update Drush in your home directory first, then move it to a globally-accessible location using @sudo@: |
16 | 8 | Jack Aponte | |
17 | 1 | Jack Aponte | <pre> |
18 | 44 | Jack Aponte | cd ~ |
19 | 57 | Jack Aponte | COMPOSER_HOME=$HOME/drush COMPOSER_VENDOR_DIR=$HOME/drush/8 composer require drush/drush:8.4.10 |
20 | 1 | Jack Aponte | cd ~/drush/8/drush/drush |
21 | 47 | Jack Aponte | composer install |
22 | 1 | Jack Aponte | cd ~ |
23 | 60 | Jack Aponte | sudo rm -rf /opt/drush; sudo mv ~/drush /opt/ |
24 | 47 | Jack Aponte | sudo chown -R root: /opt/drush |
25 | 60 | Jack Aponte | sudo rm /usr/local/bin/drush; sudo ln -s /opt/drush/8/drush/drush/drush /usr/local/bin/drush |
26 | 1 | Jack Aponte | </pre> |
27 | |||
28 | 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) |
29 | 56 | Jack Aponte | |
30 | 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. |
31 | 52 | Jack Aponte | |
32 | 59 | Jack Aponte | Use the same commands with a new version number to update Drush as needed; the commands above account for updates. |
33 | 1 | Jack Aponte | |
34 | 50 | Jack Aponte | h2. Install and update Drush Backdrop commands |
35 | |||
36 | 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. |
||
37 | |||
38 | Assuming that Drush 8 is installed in @/opt/drush/8/drush/drush@, as specified above: |
||
39 | |||
40 | <pre> |
||
41 | sudo git clone https://github.com/backdrop-contrib/drush.git /opt/drush/8/drush/drush/commands/backdrop |
||
42 | </pre> |
||
43 | |||
44 | To update Drush Backdrop commands installed like this: |
||
45 | |||
46 | <pre> |
||
47 | cd /opt/drush/8/drush/drush/commands/backdrop |
||
48 | 1 | Jack Aponte | sudo git pull origin |
49 | </pre> |
||
50 | 50 | Jack Aponte | |
51 | 56 | Jack Aponte | h2. Install Drush on May First Movement Technology and other shared hosting environments |
52 | 1 | Jack Aponte | |
53 | 56 | Jack Aponte | Primarily drawn from "this MF ticket;":https://support.mayfirst.org/ticket/11691#comment:3 thanks Ivan! |
54 | 17 | Jack Aponte | |
55 | 18 | Jack Aponte | First, install Composer following "these instructions":https://getcomposer.org/download/. |
56 | 17 | Jack Aponte | |
57 | Then to install Drush: |
||
58 | 1 | Jack Aponte | |
59 | 17 | Jack Aponte | <pre> |
60 | echo 'export PATH="$HOME/.composer/vendor/bin:$PATH"' >> ~/.bashrc |
||
61 | source ~/.bashrc |
||
62 | cd ~/<organization.org>/bin |
||
63 | 57 | Jack Aponte | composer global require drush/drush:8.4.10 |
64 | 17 | Jack Aponte | which drush |
65 | 1 | Jack Aponte | </pre> |
66 | 8 | Jack Aponte | |
67 | Note that sometimes @cgi-bin@ is present on MF/PL sites instead of @bin@. |
||
68 | 1 | Jack Aponte | |
69 | 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: |
70 | 1 | Jack Aponte | |
71 | 40 | Jack Aponte | <pre> |
72 | 1 | Jack Aponte | $aliases['organization'] = array( |
73 | 10 | Jack Aponte | 'remote-host' => 'organization.org', |
74 | 42 | Jack Aponte | 'remote-user' => 'organization', |
75 | 10 | Jack Aponte | 'root' => '/home/members/organization/sites/organization.org/web', |
76 | 'uri' => 'organization.org', |
||
77 | 45 | Jack Aponte | 'path-aliases' => array( |
78 | '%drush-script' => '/home/members/organization/sites/organization.org/users/organization/.composer/vendor/bin/drush', |
||
79 | '%dump-dir' => '~/drush-backups', |
||
80 | '%files' => '/home/members/organization/sites/organization.org/web/sites/default/files',), |
||
81 | ); |
||
82 | </pre> |