Installing drush - Manual Method

From aoxoaWiki
Jump to navigationJump to search

drush is a Drupal command-line utility that makes a number of administrative processes very simple. With drush, updating a module or updating the Drupal core is a one or two line command (one line to do the update, and an optional second line to update the database if needed).

It seems that the composer tool is now the preferred way to install and maintain both drush and drupal. See the page Installing drush for information on doing a composer-based installation.

However, some providers limit resources and that can have negative impacts on composer. You may have to install drush manually - that is where these instructions come in...


Installation

Check to find the latest versions available. Note that there are version dependencies. For use with Drupal 7, you will have to stick to drush v8

  https://github.com/drush-ops/drush/releases

Find the version you want, and save the link to the drush.phar file

Download drush.phar file

  • login to server
  • if ~/bin does not exist
    • mkdir bin
  • cd bin
  • wget https://github.com/drush-ops/drush/releases/download/8.1.16/drush.phar

Test download

  php drush.phar core-status

Rename

  chmod +x drush.phar
  sudo mv drush.phar drush

Optional - configuration

  drush init

Ensure bin directory into the PATH

The bin directory should be added to the PATH if it is not already

  • cd
  • vi .bashrc
  • (ensure no synonyms etc exist for drush already)
  • export PATH="$HOME/bin:$PATH"
  • save file

Logout/login or otherwise source/run the .bashrc file to update the PATH

Test drush

Now test drush:

  drush status

Move to a subfolder with a drupal installation:

  cd www
  drush status

Online Resources

drush Project Page (now on GitHub)

drush.org website

Drush Installation Docs


Back to Drupal