How to backup and upgrade drupal to latest version on a linux server using ssh and simple shell commands

If you use Drupal you will be both pleasantly surprised and frustrated by the frequency of updates and security patches.

This How To will help you quickly backup and upgrade your Drupal installation via ssh and simple shell commands.
You must have ssh access to your server in order to follow this tutorial.

  1. If you have ssh access, just follow these simple steps
  2. SSH into your server (duh!)

    ssh username@host
  3. change directories so you can see your public_html (web root) sometimes this is welcome or home but usually it will be public_html.
    Backing up from here will keep the backup private, and make it easy to back up your whole web directory.
    cd ~/

    will do the trick on most systems

  4. Make a backup of your public_html directory

    tar cvfz public_html_bak.tgz public_html
  5. Make a database backup

    mysqldump -u username -p dbname | gzip | mysql_bak.sql.gz
  6. Change into your public_html directory

    cd public_html
  7. Goto http://www.drupal.org and copy the location for the latest drupal version for this example lets say this is http://ftp.drupal.org/files/projects/drupal-6.13.tar.gz

    wget http://ftp.drupal.org/files/projects/drupal-6.13.tar.gz
  8. Extract the tar contents into the current directory stripping of the first directory (drupal-6.13) in this example.

    tar xvfz drupal-6.13.tar.gz --strip-components=1
  9. Run upgrade.php

All done, now wasn't that quick and painless?

Be sure to see the next How To Restore Drupal from backup on a linux server


AttachmentSize
drupal_update_howto.mov33.27 MB
Comments
(Thanks to everyone who comments)

good work

evden eve nakliyat is a leading web site hosting service provider that is known to provide reliable and affordable top medyum packages to customers. porn teen tube company believes in providing absolute and superior control to the customer as well as erotik complete security sikiş izle and flexibility through its porno izle. windows hosting Moreover, the company provides technical support as well as customer service 24x7, tuzcuoğlu nakliyat
in order to enable its customer price. Thanks instaspace


Small adjustment

Actually you should not overwrite the "sites" sub-directory because this contains all your specific settings.


Well, when making a backup I

Well, when making a backup I think having everything is good. You are correct that you do not need to backup or restores sites, but might as well make a full backup.
Just tack on --exclude="sites" if you do not want to extract it from the tar, but doing so will not hurt since you just made the backup.


Thanks

Thanks for this. I've been searching for an easier way to upgrade for the last hour and this is as simple as it gets. And worked perfectly for me.


You are welcome

I am glad you found this post helpfull.


Post new comment

  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.
  • You may link to Gallery2 items on this site using a special syntax.

More information about formatting options

728x90 banner