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
# change directory to websites
# 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
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
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
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.
# 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]
Backups were restored successfully. [ok]
I Googled for the answer. Someone suggested to turn off the rollback function, so used this command
drush up --no-backup
and the updates worked.
make new backup file.done.
Now my website is updated to the latest version of Drupal and the contributed modules are updated as well.