Web 2.0

Install Drupal 7 with Drush from Git

OK, couldn’t find a good documentation about it so I had to make some research. And since I’ll do it several times, let me take a note of the procedure and share it with you at the same time.

Parts in red should be changed by you to your specific names and details.

  1. Create an empty database, say “mysitedb“. Instructions are out of the scope of this how-to. Do not use a database that already has something in there because this procedure will drop it all.
  2. Configure your web server or hosting system to serve your new site, say “www.mysite.com“. I use DreamHost, so I’ll use DreamHost directory names in this tutorial. Be smart enough to change this directories to meet your system.
  3. Download and install Drush somewhere outside your site directory and make it globally executable:
    cd ~ ;
    mkdir software;
    cd software;
    wget http://ftp.drupal.org/files/projects/drush-7.x-4.4.tar.gz;
    tar -zxvf drush-7.x-4.4.tar.gz;
    rm drush-7.x-4.4.tar.gz;
    echo 'PATH=$PATH:~/software/drush' >> ~/.bashrc;
    echo 'alias drush="drush --package-handler=git_drupalorg" ' >> ~/.bashrc;
    . ~/.bashrc
  4. Prepare a directory to contain Drupal installation and your site files. Part of this was already done in step 2 above but we’ll have to remove the site directory since Drush will create it for us in the process:
    cd ~ ;
    [[ -d www.mysite.com ]] && rm -rf www.mysite.com;
    drush --drupal-project-rename=www.mysite.com dl drupal-7.0
  5. Create your Drupal site configuration and populate the database created on step 1:
    cd www.mysite.com;
    drush site-install standard --site-name="My Site" --site-mail=youremail@gmail.com \
           --account-name=root --account-pass=drupalpass \
           --db-url=mysql://mysitedbuser:dbpass@db.mysite.com/mysitedb \
           --db-prefix=drupal_
  6. Install obvious modules. Git will be used by default (and not tar.gz) because of the alias set on step 3:
    drush dl views;
    drush dl cck;
    drush dl panels;
    drush dl zen;

Thats it !

Now point your browser to www.mysite.com to see your Drupal site ready to be used. Login into Drupal with the user name and password that you used on parameters --account-name and --account-pass on step 5 above and optionally enable the modules you’ve just installed on step 6.

The benefit of maintaining the installation of a software written in some interpreted language (as Drupal with PHP) is on code upgrades. The upgrade process aided by a versioning system (as Git) will cirurgically add, modify and delete the necessary files without leaving old unused files. In a tar.gz (or zip) scenario, you’ll unpack a new version archive over your previous installation, which will not handle correctly specially deleted files.

11 comments to Install Drupal 7 with Drush from Git

Leave a Reply

  

  

  

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>