Drush インストール

Nid: 1157

最新バージョンの9をインストールしたが、リストア含め様々な場面でエラーが出るので、後半に記述するComposerを使用しない6.1.0を推奨する。

 

Composer インストール

$ curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
All settings correct for using Composer
Downloading...

Composer (version 1.8.0) successfully installed to: /usr/local/bin/composer
Use it: php /usr/local/bin/composer
$ sudo composer self-update
You are already using composer version 1.8.0 (stable channel).

cgr tool インストール

$ composer global require consolidation/cgr

Drush インストール

$ vi .profile
export PATH="$HOME/.composer/vendor/bin:$PATH"
$ cgr drush/drush
$ cd .composer/vendor/bin/
$ mv drush drush9
$ drush9 status
 PHP binary    : /usr/bin/php7.2
 PHP config    : /etc/php/7.2/cli/php.ini
 PHP OS        : Linux
 Drush script  : /home/claire/.composer/vendor/bin/drush
 Drush version : 9.5.2
 Drush temp    : /tmp
 Drush configs : /home/claire/.composer/global/drush/drush/vendor/drush/drush/drush.yml
 Drupal root   : /home/claire/.composer/global/drush/drush/vendor/drush/drush/sut

 

Drush 旧バージョン6.1.0インストール - Composerを使用しない最終バージョン

$ wget -cP /tmp https://github.com/drush-ops/drush/archive/6.1.0.zip
$ sudo unzip /tmp/6.1.0.zip -d /usr/share/php
$ sudo ln -s /usr/share/php/drush-6.1.0/drush /usr/bin/drush
$ which drush
/usr/bin/drush
$ drush -vd status
Bootstrap to phase 0. [0.01 sec, 1.97 MB]                            [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drush() [0.01 sec, 2.05 MB] [bootstrap]
Cache HIT cid: 6.1.0-commandfiles-0-0346f5a1df29b417706bc084627cad81 [0.01 sec, 2.06 MB]                                                                                    [debug]
Bootstrap to phase 0. [0.04 sec, 5.06 MB]                                                                                                                               [bootstrap]
Found command: core-status (commandfile=core) [0.05 sec, 5.07 MB]                                                                                                       [bootstrap]
Loading outputformat engine. [0.06 sec, 5.08 MB]                                                                                                                           [notice]
Calling hook drush_core_status [0.06 sec, 5.14 MB]                                                                                                                          [debug]
Returned from hook drush_core_status [0.06 sec, 5.14 MB]                                                                                                                    [debug]
count(): Parameter must be an array or an object that implements Countable Table.php:699 [0.06 sec, 5.17 MB]                                                            [warning]
count(): Parameter must be an array or an object that implements Countable Table.php:699 [0.06 sec, 5.18 MB]                                                            [warning]
count(): Parameter must be an array or an object that implements Countable Table.php:699 [0.06 sec, 5.18 MB]                                                            [warning]
count(): Parameter must be an array or an object that implements Countable Table.php:699 [0.06 sec, 5.18 MB]                                                            [warning]
count(): Parameter must be an array or an object that implements Countable Table.php:699 [0.06 sec, 5.18 MB]                                                            [warning]
count(): Parameter must be an array or an object that implements Countable Table.php:699 [0.06 sec, 5.18 MB]                                                            [warning]
 PHP executable        :  /usr/bin/php
 PHP configuration     :  /etc/php/7.2/cli/php.ini
 PHP OS                :  Linux
 Drush version         :  6.1.0
 Drush configuration   :
 Drush alias files     :  /etc/drush/allsites.aliases.drushrc.php

Command dispatch complete [0.06 sec, 5.11 MB]                                                                                                                              [notice]
Peak memory usage was 5.86 MB [0.06 sec, 5.11 MB]                                                                                                                          [memory]