=======
Note: I'm leaving this page as is for information purposes, but I don't recommend you follow this tutorial for installing Drush. I recommend using composer to install Drush.
=======

Below is how I install Drush on CentOS systems that have H-Sphere installed as a control panel

1 - Grab a copy of Drush and untar it in your shared folder

sudo wget --quiet -O - http://ftp.drupal.org/files/projects/drush-7.x-5.9.tar.gz | sudo tar -zxf - -C /usr/local/share

(Note, change the link above you the link to the latest version of drush on Drupal.org.)

2 - Create a symbolic link to where Drush can be found on your server

sudo ln -s /usr/local/share/drush/drush /usr/local/bin/drush

3 - Get Drush to auto download the required "stuff"

sudo drush

Drush won't work yet as it won't know where to find php, so

4 - Open your bash_profile file and edit the PATH line from something like this:

bash_profile: PATH=/hsphere/shared/bin:/hsphere/shared/sbin:/hsphere/local/var/vpopmail/bin:/usr/local/bin:/usr/local/sbin:$PATH:$HOME/bin

to something like this (note the php path in this version):

PATH=/hsphere/shared/bin:/hsphere/shared/sbin:/hsphere/local/var/vpopmail/bin:/usr/local/bin:/usr/local/sbin:/hsphere/shared/php53/bin:$PATH:$HOME/bin

5 - Reload your bash_profile
. ~/.bash_profile

These notes are also available here.

Comments

TomGould01’s picture

There's no need to reboot, just reload the .bash_profiles file eg:

.  ~/.bash_profile
alexmoreno’s picture

markconroy’s picture

Thanks Tom.

I've edited the main text now to reflect that.

============

Drupal Core Maintainer for "Out of the Box" Initiative
Annertech - Web Agency of the Year.

WebWalker3D’s picture

Why is everyone recommending using Pear to install Drush? *edit* Everything is switching to composer.

Half Full or Half Empty, it's Still a Glass...
Website: https://www.binarycpu.com

yuseferi’s picture

# Download latest stable release using the code below or browse to github.com/drush-ops/drush/releases.
wget http://files.drush.org/drush.phar

# Test your install.
php drush.phar core-status

# Rename to `drush` instead of `php drush.phar`. Destination can be anywhere on $PATH.
chmod +x drush.phar
sudo mv drush.phar /usr/local/bin/drush

# Enrich the bash startup file with completion and aliases.
drush init

I have be born to be mankind