Maintaining WordPress Installations – The Easy Way

By | 2009/02/27

I’ve seen a few posts over here regarding problems with an unmaintained WordPress installation. It definitely can be work to manage software that is not covered within the supported repositories (WP is in the repositories, but its not updated as frequently as upstream). I thought I would cover how I maintain my installations and hopefully they can help others simplify their process.

First of all let me outline the setup that I have.  I run a number of virtual hosts on my web server.  Probably close to a dozen WP installations, plus a few other sites.  I’ve simplified the installation and updating process for these by using svn, which has been an option from WP for some time now.  Example:

To install a new WordPress blog using svn:

svn co http://svn.automattic.com/wordpress/tags/2.7.1/ .

note: You’ll, of course, want to update the “2.7.1” tag with the current version at the time of your installation.

note: Make note of the “.” at the end of that command.  Yes, it’s required.  Yes it’ll install WordPress to the directory you run the command in.

To update your installation when word gets out that there has been a new release:

svn sw http://svn.automattic.com/wordpress/tags/2.7.x/ .

note: see notes above 😉

Now, if you’ve got a number of virtual hosts and multiple wordpress installations installed you could do something like I’ve done and script the process.  Here is an example script I use to update all of my wordpress installations with one command:

#!/bin/bash
# wp-update.sh
# update wordpress installation(s) to $1 branch
#
# this script takes the new branch as an argument


DOMAINS="domain1.tld
domain2.tld
domain3.tld
domain4.tld
domain5.tld
domain6.tld
domain7.tld
domain8.tld
domain9.tld
domain10.tld
domain11.tld
domain12.tld"

if [ $# -ne 1 ]; then
echo "EPIC FAIL: Missing new version!"
echo "Try: ./wp-upgrade x.x.x (ie; 2.7.1)
exit 1
fi

for site in ${DOMAINS}; do
echo "upgrading ${site}"
echo
cd /var/www/virtual/${site}/html/
svn sw http://svn.automattic.com/wordpress/tags/$1/ . &>/dev/null
done

The only things you’ll really need to keep in mind to use this script are:

  1. You’ll need subversion installed.
  2. This assumes a virtual host path of /var/www/virtual/${domain}/, and WP root of html/.  Update as necessary.
  3. You’ll need to chmod +x this script.

Once you’ve saved and update the script according to your setup you’ll simply want to run the script anytime you get word of a new WordPress release:

./wp-update.sh 2.7.3

Done.  Simple.  Enjoy.

4 thoughts on “Maintaining WordPress Installations – The Easy Way

  1. ebflute

    what if you want to install the wordpress files in the webrooot (www) through subversion? Do you have to have the folder named x.x.x?

    Reply
  2. zelut Post author

    You do not need a folder called x.x.x. The version string is on the other end. When you pull it down append the URL with a <code>.</code> and it will install to the local directory.

    Reply
  3. ebflute

    Thank you Christer, I got the wordpress files to install in the root thanks to you!

    Reply

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.