Drush is a command line shell that you can use to easily download and update Drupal core and contributed modules. It saves time when you type in commands instead of navigating the admin interface and manually configuring Drupal.
In this tutorial, I will describe the process of how to update your Drupal 7 website using Drush.
I have a brochure website built with Drupal 7.12. I need to update it to the current version, Drupal 7.14. This is called a minor update.
Note: # denotes a comment
cd websites
# change directory to websites
drush dl
# this downloads the current version of Drupal 7
# you will see a new directory called drupal-7.14
mv drupal-7.14 newsite
# this copies the drupal-7.14 directory renames it to be newsite
cd newsite
Create new database, username and password in phpMyAdmin
Setup config so that you can access your new site in the browser like so,
http://newsite
cd newsite
Run install.php
Enter database info
Setup file path and private file path
If you have problems with write permissions, please refer to install.txt for troubleshooting.
Take site offline and run update.php
Make backup of blank database
Copy over the sites/all/modules directory from your old site
Copy over the sites/all/libraries directory
Copy over the sites/all/themes directory
Copy over the sites/default/files directory
Enable Admin menu and Backup migrate modules
Restore the backup from your old website
Run update.php
Make a new backup.
Check the status report and see it any other modules need updating
Use drush to update any modules that need updating.
drush up
# this commmand will list all the moudles that need updating
# and ask you if you want to continue. Select y
I encountered a problem. Drush listed all the updates and then rolled back the updates. Message says backup restored successfully. This error occurs when there is you run drush up and fetching updates fails
Here is the output.
Do you really want to continue? (y/n): y
Project drupal was updated successfully. Installed version is now 7.2.
Backups were saved into the directory [ok]
/home/xxx/drush-backups/xxx/20110622192752/drupal.
Backups were restored successfully. [ok]
I Googled for the answer. Someone suggested to turn off the rollback function, so used this command
Source:
http://drupal.org/node/1196972#comment-5606254
drush up --no-backup
and the updates worked.
ran update.php
make new backup file.done.
Now my website is updated to the latest version of Drupal and the contributed modules are updated as well.
Comments
Update Drupal core and contrib modules with one command