Installing a new Drush on an old Server

  • If php 5.3 is the highest version available on the server (as is the case with CentOS 5), then Drush 7 will have to be used.
  • The version of drush will have to be build on another machine on which composer can be installed, and then moved to the server.

The latest versions of Drush can be found here: github.com/…ops/drush/releases

sudo apt install composer
sudo apt install php7.0-xml

VER=7.3.0
curl -L https://github.com/drush-ops/drush/archive/$VER.tar.gz
tar -zxf drush-$VER.tar.gz
rm drush-$VER.tar.gz
mv drush-$VER drush7

cd drush7
composer update
cd ..
drush7/drush --version
rsync -a drush7 server:/root/ #move to target server (e.g. CentOS system)
  • If drush is going to be merged into a dsite folder using svn, then this code can be used:
VER=7.3.0
REPOCONTRIBCI=https://subversion.assembla.com/svn/drupal_contrib
dver=7
codedir=/opt/dr$dver
REPROOT=trunk
REPUSER=andrewfn

read -s -p "Type SVN password for $REPUSER and press Enter: " REPPASS
echo
echo "Updating REPO:$REPOCONTRIBCI OFFSET: $REPROOT$dver/modules/drush FROM: drush7 INTO: $codedir/contrib/modules/drush"
svn_load_dirs.pl $REPOCONTRIBCI $REPROOT$dver/modules/drush drush7 -wc $codedir/contrib/modules/drush -message="updated drush to $VER" -svn_username $REPUSER --svn_password $REPPASS
rm -Rf drush7
$codedir/contrib/modules/drush/drush --version