Install Drupal 7 with Drush and composer

Drush is a command line shell and Unix scripting interface that automates may administration tasks for Drupal.  The new drush version 4 adds commands.  You can read the documentation to explain more.  There is also the drush.org web site at drush.ws. Look for examples at:<drush path>/examples/ 

Overview of steps

  1. Install Composer
  2. Add composer's bin directory to the system path by placing export PATH="$HOME/.composer/vendor/bin:$PATH" into your ~/.bash_profile (Mac OS users) or into your ~/.bashrc (Linux users).
  3. Install latest stable Drush: composer global require drush/drush
  4. Verify that Drush works: drush status

1. To install Composer on Centos, Red hat or Fedora

Follow the instructions put together by idroot

Step 1. First let’s start by ensuring your system is up-to-date.

yum -y update

Step 2. Installing Composer.

Download and install Composer by executing the following command:

curl -sS https://getcomposer.org/installer | php

Once the process completes, you can make the ‘composer.phar’ file executable by running the following command:

chmod +x composer.phar

Now use the following commands to make composer available globally for all users in your system, which can be used for all php applications on that system:

mv composer.phar /usr/local/bin/composer

You can also check the version of composer by running bellow command:

composer -V

To install drush

Download the current version from http://drupal.org/project/drush

and run tar -xvzf drush-7.*.tar.gz

Then create a symbolic link to drush:

# sudo ln -s /opt/drush/drush /usr/local/bin/

If you cannot create a symbolic link you can create an alias to drush:

# echo "alias drush='php /opt/drush/drush.php'" >> ~/.bash_profile

Test Drush

# drush status

Learn more about Drush

# drush topic  

To Create a new Drupal 7 (D7) install using Drush

Use the following to install and setup drupal 7 fast.

Download Drupal Software

# drush dl drupal

You may want to rename or move the directory contaning the drupal software

# mv drupal-7.0 /www/drupal

Create a new mysql database for the Drupal site

Create a new mysql database using phpMyAdmin

Create a new site

# drush site-install standard --db-url=mysql://drupal7:password@localhost/drupal7

Add to Apache Config

# vi conf.d/drupal7.conf

Optionally configure drupal to run from a subdirectory on the web server i.e. /drupal7

vi /www/drupal/.htaccess

Uncomment the line RewriteBase / and change the path to the sub directory you are running drupal from for example RewriteBase /drupal7

Login to the new site as admin/admin

http://localhost/drupal7

Change the Admin password

Select Menu people->admin->edit or use the drush command:

# drush user-password admin --password newpassword

Download and enable modules

# drush dl views ctools
# drush enable views ctools
y

Update Drupal core. For example, 6.14 to 6.15

# cd ~
# drush dl drupal
# rm -r ~/drupal-6.15/sites/
# mv ~/drupal-6.14/sites/ ~/drupal-6.15/
# rm ~/drupal
# ln -s ~/drupal-6.15/ drupal
# drush update

Check modules status

# drush statusmodules

Drush can now update itself

# drush selfupdate

Subject