Install Drush for Drupal 7.x on DirectAdmin

If you want to install Drush for Drupal 7.x on DirectAdmin (CentOS 8, RHEL 8 / AlmaLinux), you came to the right place.

1. Install dependencies

Login via SSH to the server and execute the following commands to install Git and download Composer.

sudo yum install git
curl -sS | php
sudo mv composer.phar /usr/local/bin/composer
sudo ln -s /usr/local/bin/composer /usr/bin/composer

2. Download Drush via Git

sudo git clone /usr/local/src/drush
cd /usr/local/src/drush

Use Git to checkout the version of Drush that you wish to use. Find the latest versions on the GitHub releases page.

However, keep in mind that Drush 9 and onwards have dropped support for Drupal 7.x. This means that with Drupal 7.x, you can only use Drush up to version 8.x. As of this moment, the latest available version is 8.4.8, so we checkout this version:

sudo git checkout 8.4.8

Create a symbolic link between the Drush directory in /usr/local/src to /usr/bin. This makes it so that you will be able to run the drush command from any directory on the server.

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

3. Install Drush via Composer

composer install

If everything went OK you should now be able to run Drush. Test it with this command:

[root@lanedirt]# drush --version
 Drush Version   :  8.4.8

Note: if you see any errors like “PHP Warning: proc_open() has been disabled for security reasons” instead of the output above and you are running DirectAdmin, you might need to tweak the PHP secure mode settings.

By Leendert de Borst

Freelance software architect with 10+ years of experience. Expert in translating complex technical problems into creative & simple solutions.

Leave a comment

Your email address will not be published. Required fields are marked *