SSH/Shell update Drupal from a minor version to another

Drupal Hello everyone,
last day I had to update Drupal 7.10 to the most recent at the moment (7.12), I never did something like that so I was like “here we go, 1 work day that will go burned! :D”, but thanks to the Drupal community I was able to update the installation.

Since isn’t very easy at first (reading UPGRADE.txt was not helpful unfortunately), therefore here a quick list of the steps:

  1. Put your site into maintenance mode or close accesses from the outside.
  2. First of all, backup your installation folder (usually a rsync -av startfolder destinationfolder, or a cp -a startfolder destinationfolder will do the job just fine)
  3. Then you have to backup your database (you can do it all in one step using screen, but I bet that if you are reading this and you are experienced you already know that), depending if you are running MySQL or PostgreSQLthe instructions changes, but I think could be sum up as follows:
    • MySQL: mysqldump -uUser -pPassword -hHost dbname > dumpname.sql
    • PostgreSQL: pg_dump databasename > dumpname.sql

    If you use PostgreSQL you need to remember that the operations have to be done with the correct user. Refer to the documentation for further details.

  4. After you have done the backups, reach your site root folder and create a folder to hold the new Drupal version, something like mkdir upgrade, then enter inside it with cd upgrade.
  5. Download the archive with wget http://ftp.drupal.org/files/projects/drupal-7.12.tar.gz.
  6. Open the archive with tar -xzvpf drupal-7.12.tar.gz.
  7. Then enter the newly created directory like we did before, cd drupal-7.12.
  8. At this point we have all that we need, this step is the actual upgrade, we have to move some files in the root directory, assuming you followed this steps, the command you need is the following:
    rsync -av CHANGELOG.txt COPYRIGHT.txt cron.php includes index.php INSTALL.mysql.txt INSTALL.pgsql.txt install.php INSTALL.txt LICENSE.txt MAINTAINERS.txt misc modules profiles scripts themes update.php UPGRADE.txt xmlrpc.php ../../
  9. After you have done that, should be an instant action, open your browser and go to your website URL and add a /update.php at the end, you should have http://www.myawesomedrupalsite.com/update.php.
  10. Follow the instruction on-screen to complete the update process on the database, don’t change anything from the dropdowns.
  11. Once the update is complete you may remove the directory we created to download and extract drupal.

Is not very short but is all you need to do.

Enjoy!