Saturday, March 27, 2010

How to Upgrade Wordpress in less than 10 Seconds

Upgrading Wordpress can be a major pain (if you don’t know what you’re doing).

The typical update path would either use the built in wordpress upgrade function (which doesn’t work for all server setups) or something like:
  1. Visit wordpress.org
  2. Download the latest zip file to your pc
  3. Unzip the latest file
  4. Fire up your FTP program
  5. Connect to your server
  6. Navigate to your blog folder
  7. Upload the new Wordpress files
  8. Wait 5+ Minutes for the files to upload one by one
  9. Visit the upgrade page on your Wordpress Blog
  10. Finished!
Doing the above could take 15-20mins or more. So how can we do it in less than 10 seconds? Easy, via the command line.

How to Upgrade Wordpress from the Linux/UNIX command line

Log into your shell account & replace /var/www/ with the folder that your blog resides in (i.e. home/blog/public_html).

1.tar -zcvf /var/www/wordpressbackup/120809.tar.gz /var/www/blog
2.mkdir /var/www/tmp
3.cd /var/www/tmp
5.unzip latest.zip
6.cd /var/www/blog
7.cp -avr /var/www/tmp/wordpress/* .
8.rm -rf /var/www/tmp/wordpress /var/www/tmp/latest.zip

So, looks simple eh? Lets have a look at what these commands do:
  1. Takes a backup of your current Wordpress installation (change the date to the current date)
  2. Makes a new directory called tmp
  3. Changes to the tmp directory
  4. Grabs the latest wordpress zip file
  5. Unzips the wordpress zip to the tmp directory
  6. Changes to the blog directory
  7. Copies & replaces everything in your wordpress directory with the new files
  8. Removes the tmp directory & the zip file

Caveats

There are a few issues with this method that you should be aware of before trying yourself.
  • The folder that your blog sits in will be different then /var/www/blog/ so make sure you change this.
  • The commands overwrite existing files but it do not delete legacy or discontinued files
  • Make sure you backup your directory & mysql database just incase your make any mistakes

Labels:

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home