Drush is a command line interface that allows to manage your Drupal web sites fast and easy. This scripting shell should be additionally installed on your hosting server in order to benefit from its features.
First, you need to have a Drupal installation under your hosting account. It can be completed in several mouse clicks through cPanel -> Softaculous.
Second, you need SSH access to your account in order to run Drush commands.
In this part of the Drupal tutorial we will show how to use Drush in order to backup and update your script, install and activate Drupal extensions, remove them and clear the script’s cache.
In order to create a backup of your Drupal web site with Drush follow the steps listed below:
- Log in your account via SSH.
- Navigate to the Drupal installation’s home folder.
- Run the following command:
drush archive-backup –destination=/home/cPuser/backup/site.tar.gz
Replace the cPuser variable with your actual cPanel user. You can pick a different location for the backup and different backup file name.
Executing the command listed above will create an archive with all the web site files and a dump of your Drupal database.
The output will be similar to the following one:
If you need to restore a backup of your web site use the following command:
drush archive-restore /home/cPuser/backup/site.tgz
The output will be similar to:
To update the Drupal application execute the following command:
drush pm-update
The above command will also update the plugins.
To install a chosen plugin you should download and enable it. Check the example listed below:
drush dl addtoany
Project addtoany (7.x-4.0) downloaded to sites/all/modules/addtoany. [success]
drush en addtoany
Instead of AddToAny you can pick a different Drupal plugin or module. The skip the Do you really want to continue? prompt modify the command in the following way:
drush en -y addtoany
A chosen extension can be disabled and removed with two simple commands. Check the example:
drush dis -y addtoany
drush pm-uninstall -y addtoany
Often the Drupal web site administrators need to clear the script’s cache. It can be easily completed with the following command:
drush cache-clear all
If the webmaster prefers to clear different types of cache the options can be listed:
drush cache-clear
To get help on the Drush commands run the following command:
drush help
If you want to learn how to use a specific command enter the following line in the shell:
drush help command
Replace the “command” string with the chosen one. For example:
drush help archive-backup
More about Drush can be found in the official documentation of the project: http://drush.ws/
No comments:
Post a Comment
Thanks for your comment.