Blog

Install Drush for Drupal on a Linux Server

Tags: Linux

Published on: June 17, 2021 by Gary Griffith

Install Drush for Drupal on a Linux Server

Scenario:

The word Drush stands for DRUpal SHell and it is a command line utility used to communicate to Drupal CMS. For one who enjoy working from the shell, installing Drush is going to save your time for sure. Drush allows you to install/configure modules and themes without logging to your Drupal dashboard. Drush can be used for troubleshooting errors and for regular maintenance/updates.

You can follow the below steps to install Drush on your cPanel account.

Step1: Login to your your server using SSH.

Step2: Installing composer

Check whether you have composer installed already:

[otw_shortcode_info_box border_type=”bordered” border_color_class=”otw-blue-border” border_style=”bordered”]which composer[/otw_shortcode_info_box]

If not installed already, install it using the below command:

[otw_shortcode_info_box border_type=”bordered” border_color_class=”otw-blue-border” border_style=”bordered”]curl -sS https://getcomposer.org/installer | php[/otw_shortcode_info_box]
Then move the composer.phar file to your bin folder using the below command:
[otw_shortcode_info_box border_type=”bordered” border_color_class=”otw-blue-border” border_style=”bordered”]mv composer.phar ~/bin/composer.phar[/otw_shortcode_info_box]
Then open your .bashrc file and add the following:
[otw_shortcode_info_box border_type=”bordered” border_color_class=”otw-blue-border” border_style=”bordered”]alias composer=”php ~/bin/composer.phar”[/otw_shortcode_info_box]

Then run the following command:

[otw_shortcode_info_box border_type=”bordered” border_color_class=”otw-blue-border” border_style=”bordered”]source ~/.barhrc [/otw_shortcode_info_box]
The above command will reloads your .bashrc file so it’s available immediately and now by that way you would be able to use the composer command without specifying the full path each time.
Step3: Installing Drush
[otw_shortcode_info_box border_type=”bordered” border_color_class=”otw-blue-border” border_style=”bordered”]composer global require drush/drush:dev-master[/otw_shortcode_info_box]
Then again, add the following alias in your .bashrc:
[otw_shortcode_info_box border_type=”bordered” border_color_class=”otw-blue-border” border_style=”bordered”]alias drush=”~/.config/composer/vendor/bin/drush” [/otw_shortcode_info_box]

Then run the below command:

[otw_shortcode_info_box border_type=”bordered” border_color_class=”otw-blue-border” border_style=”bordered”]source ~/.barhrc [/otw_shortcode_info_box]

And finally its done. Now drush should be available and try it by running just the drush command:

[otw_shortcode_info_box border_type=”bordered” border_color_class=”otw-blue-border” border_style=”bordered”]drush [/otw_shortcode_info_box]

Category : Linux

Gary Griffith

Gary Griffith

Gary Griffith is working as System Engineer at SupportSages for the last two years. He is very passionate about Linux and server management and always interested in the emerging cloud technologies. Apart from work, he is very interested in cooking and music.

You may also read:

Comments

Add new commentSIGN IN

Let's Connect

Categories

Your Cart

Cart is empty.

Subtotal
₹0.00
APPLY
0
Send this to a friend