How to Install Drupal 7 using Drush?

Why Drush?

Because it makes installing Drupal as easy as pasting 2 lines of code

Steps to install Drupal 7 using Drush

You need to have Drush installed, if you don’t please follow our Drush install tutorial

Open a Terminal window

Navigate to your Document root directory (where you normally place your sites)

cd /path/to/document/root

Execute this command to download drupal

drush dl drupal-7 --drupal-project-rename=my_drupal_site

This command downloads the latest drupal 7 release and places it in a directory named my_drupal_site

Navigate to your Drupal site directory

cd my_drupal_site

Execute this command to install drupal

drush si --db-url=mysql://[db_user]:[db_password]@localhost/[db_name] --site-name="My Drupal Site"

Replace [db_user] with you database username, [db_password] with your db password and [db_name] with the database name

This command will create the database and install Drupal on this database

The admin account will have a random password which will be echoed out, if not use the following command to change the admin password

drush upwd --password="new_password" admin

 

I hope you've enjoyed this tutorial and stay tuned for more to come

Share this post