I had trouble installing Drush on my newly created Centos box. Therefore, I have documented my steps.
First, you need install Composer ( PHP Dependency Manager) cd into the
$ cd /tmp
Download Composer.phar here
$ curl -sS https://getcomposer.org/installer | php
Then move it to /usr/local/bin so that it can be used globaly.
$ mv composer.phar /usr/local/bin/composer
Now type $composer
If you done everything right you should get something that look like this:
/ ____/___ ____ ___ ____ ____ ________ _____
/ / / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
/ /___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ /
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
Composer version 1.2.1 2016-09-12 11:27:19
command [options] [arguments]
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
--profile Display timing and memory usage information
--no-plugins Whether to disable plugins.
Now it time to install drush globally to your box. This is partly taken from the Drush website with slight changes
cd into the opt directory
$ cd /opt
create a directory for crush
$ mkdir --parents /opt/drush-6.x
cd into it
$ cd /opt/drush-6.x
# Initialise a new Composer project that requires Drush.
$ composer init --require=drush/drush:6.* -n
change your version if you need a new version like 7. See more instruction at the drush doc site.
# Configure the path Composer should use for the Drush vendor binaries.
$ composer config bin-dir /usr/local/bin
# Install Drush.
$ composer install
Now test you drush by typing ‘drush’
If you have done everything right you should get drush commands shown below.
Execute a drush command. Run `drush help [command]` to view command-specific
help. Run `drush topic` to read even more documentation.
Global options (see `drush topic core-global-options` for the full list):
-d, --debug Display even more information,
including internal messages.
-h, --help This help system.
-n, --no Assume 'no' as answer to all prompts.
-r , --root= Drupal root directory to use
(default: current directory).
-s, --simulate Simulate all relevant actions (don't
actually change the system).
-l , URI of the drupal site to use (only
--uri= needed in multisite environments or
when running on an alternate port).
-v, --verbose Display extra information about the
-y, --yes Assume 'yes' as answer to all
Core Drush commands: (core)
archive-dump (ard, Backup your code, files, and database into a single file.
archive-restore Expand a site archive into a Drupal web site.
Getting updates for your packages including drush with composer
# Navigate to the Drush install path.
$ cd /opt/drush-6.x
# Run composer update
If you get "Do not run Composer as root/super user! See https://getcomposer.org/root for details" run it as not root user then su into root to finalise the rest of the installation
There you have it enjoy.