drupal 安装Drush

示例

手动全局安装

对于OS X和Linux:

  1. 调出Terminal,Bash或您的普通外壳。

  2. 在Terminal / Bash中输入以下内容:

    # Download latest stable release using the code below or browse to github.com/drush-ops/drush/releases.
    php -r "readfile('http://files.drush.org/drush.phar');" > drush
    # Or use our upcoming release: php -r "readfile('http://files.drush.org/drush-unstable.phar');" > drush
    # Test your install.
    php drush core-status
    # Make `drush` executable as a command from anywhere. Destination can be anywhere on $PATH.
    chmod +x drush
    sudo mv drush /usr/local/bin
    # Optional. Enrich the bash startup file with completion and aliases.
    drush init

对于Windows:

  1. 从GitHub下载Drush。

  2. 将压缩文件解压缩到所需的驱动器中,例如。

    C:\
  3. 安装Drush,在环境路径变量中定义提取的文件夹路径,该变量还应包含Apache, PHP and MySQL。

    C:\xampp\apache\bin;C:\xampp\mysql\bin;C:\xampp\php;C:\drush;
  4. 验证Drush是否有效:

    drush status

Composer全局安装

  1. 全局安装Composer。

  2. 通过将Composer的bin目录添加export PATH="$HOME/.composer/vendor/bin:$PATH"到您的〜/ .bash_profile(OS X)或〜/ .bashrc(Linux)中,将其添加到系统路径。

  3. 安装Drush:

    composer global require drush/drush
  4. 验证Drush是否有效:

    drush status

Drush Docs的更多详细信息