Drush available on Shared Hosting Environment

With the daily improvement of our Shared Hosting environment, we have managed to boost the performance and the services included in our Drupal Hosting Package with one more which happens to be mandatory for today’s Drupal related hosting services. Drush is a command line tool for one of the most used Open Source CMS Platforms – Drupal. The name Drush is an actual combination of two words. The first one is Drupal which you should be quite familiar with and the second one is Shell.

Literally, Shell is a command line interface which provides you with the opportunity to communicate with servers using simple text commands often called instructions. Shell is provided in nearly every hosting package we offer with the only difference that in our VPS and Dedicated Servers Hosting packages we can provide you a higher level of access(root) in comparison to the Shared Hosting environment (user).

What can Drush do?

With Drush, you will be able to perform key administrative tasks on your Drupal based web projects. Such tasks are for example:

  • Installing Drupal
  • Updating Drupal
  • Installing modules on Drupal
  • Updating modules on Drupal
  • Downloading and enabling themes
  • Run the Drupal Cron
  • Clear your website’s cache Run SQL commands directly against your Drupal database Displaying information about your Drupal installations

and much much more. You can receive a full list of the commands Drush introduces in its latest version and overall at a dedicated website to the Drush command line.

How to use Drush?

Drush usage on our shared hosting environment is quite an easy task. The Drupal command line tool is accessible with the simple command:

$ drush

followed by additional parameters to the command depending on the task you would like to handle. Let’s check out the most basic parameters and their output.

  • Clearing cache – command: drush cache-clear
$ drush cache-clear Enter a number to choose which cache to clear. [0] : Cancel [1] : drush [2] : all [3] : theme-registry [4] : menu [5] : css-js [6] : block [7] : module-list [8] : theme-list [9] : registry 2 'all' cache was cleared.
  • Creating a backup for your Drupal website and database – command: drush archive-dump
$ drush archive-dump Database dump saved to /tmp/drush_tmp_1428259280_552181d0280be/s1intfco_drup2.sql [success] Archive saved to /home/user/drush-backups/archive-dump/20150405184111/s1intfco_drup2.20150405_184112.tar.gz [ok] /home/user/drush-backups/archive-dump/20150405184111 /s1intfco_drup2.20150405_184112.tar.gz
  • Installing Drupal – command:
drush site-install standard --account-name=admin --account-pass=admin --db-url=mysql://YourMySQLUser:RandomPassword@localhost/YourMySQLDatabase

There are few things I should mention here. First and foremost you will need to download the Drupal version(quite an easy task with the drush dl drupal-7.0 command which will download version 7.0). Secondly, you will need a database name, database username and random password. You can easily generate these following our cPanel Database tutorial. Next, you will need to simply replace those components in the command above.

  • Adding a new user to your website – command:
drush user-create newuser --mail="user@domain.com" --password="somepassword"
$ drush user-create newuser --mail="user@domain.com" --password="somepassword" User ID: 4 User name: newuser User mail: user@domain.com User roles: authenticated user User status: active
  • Resetting password for user – command:
drush user-password someuser --password="correct horse battery staple"
$ drush user-password newuser --password="VeryStongPassword@#$" Changed password for newuser

Conclusion

As you can see Drush can be quite handy as the biggest downside of Drupal these days is that it has so many features implemented that you need to walk your way to the desired functionality in a timely manner. Using the command line can be scary and frustrating especially to new users that have never messed around with bash or shell, however with Drush they will always have good examples of what they can achieve. With the flexibility of the command line, Drush will bring your Drupal Hosting experience to the next level. Just in case you find any issues with the tool or you would like to make a suggestion how we can improve it please contact our Technical Support Team by submitting a ticket and they will gladly assist you.

Christopher

Christopher has many years of experience leading teams in the fields of Technical support, Server Administration, and Product Development. He mainly works on the backend, helping to create the infrastructure that powers FastComet. He is responsible for flawless migrations and quick and efficient answers to client questions. He also monitors our network status and jumps in to solve time-sensitive issues like DDoS attacks and stops malicious attempts in their tracks. Christopher’s primarily responsible for making sure that our servers purr along, and has worked tirelessly to improve automation at FastComet.