How to: Upgrade Drupal core using Linux-Shell and Drush

April 5, 2011

I have just recently embraced Drush (short for Drupal Shell) to maintain some common tasks when dealing with Drupal™ websites.
Required you have installed drush and set up an appropiate alias and you aim to update your Drupal 6.x installation do the following from the command line:

  1. cd /var/www/yoursite
    Change the work directory to the directory where your website resides.
  2. drush dl
    This will download the most recent core version of Drupal that matches your major Drupal version. In my case this was Drupal 6.20. If you upgrade to another version replace the directory names appropiately.
  3. cp -rf sites/all/modules/drupal-6.20/. .
    This will recursively copy the new core files and overwrite previous versions.
    NOTE: if you have made any changes to the robots.txt oder .htaccess files so back them up prior to this command and merge them after the update!
  4. rm -r sites/all/modules/drupal-6.20
    Removes the newly downloaded Drupal version. This is essential to avoid PHP giving you errors of duplicate function definitions as well as prevents from screwing up the whole site. It does if you don’t delete it, I tried.. multiple times ;)
  5. drush updatedb
    This will run any database updates needed by the Drupal core modules.

Tada, all done. Go to http://www.yoursite/admin/reports/status and http://www.yoursite/admin/modules to have a look at the core version as well as the core modules version. It should now label 6.20 (or whatever you upgraded to).


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: