Home Articles Easily Updating WordPress with Subversion

Easily Updating WordPress with Subversion


Lately I was having a lot of trouble updating the WordPress installs on all the blogs that I manage. Doing it with FTP can be extremely slow and time consuming. I used to upload the zipped WordPress directory and then unzipping and updating via SSH, however, this still was pretty complicated. I’ve been wanting to try updating WordPress via Subversion for ages, and I finally did.

There is an article about this on the WordPress site, but I’m going to outline what worked for me.

Connecting to your host via SSH

First, you need to have access to your host via SSH. If you don’t know how to do this, ask your hosting provider.

Installing Subversion

My MediaTemple DV server didn’t have Subversion installed, that’s one of the reasons I didn’t use it. So first, I had to install it. After a couple of hours of reading tutorials, installing packages and beating my head against the wall, I found out that you can get Subversion and other stuff by installing something they call “Developer Tools” from the admin panel.

Again, if you don’t have Subversion installed on your server, the best option is to ask your host.

Seting up a Subversion repository

For the sake of this tutorial let’s assume that your current WordPress install is at root level (“/WordPress”).

Here comes the fun part… Once you’re connected to your host via SSH you’ll have to create a temporary directory where we’re going to setup our repository (this varies depending on your setup):

cd /
mkdir wp
cd wp

Now download the latest WordPress version (currently 2.5.1):

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

To avoid problems later, I’m removing everything from the wp-content directory:

rm -rf wp-content/themes
rm -rf wp-content/plugins
rm -f wp-content/index.php

Then we’re going to copy the custom stuff from our current WordPress, that is, the themes, the plugins, the uploads, etc.

cp -rpf /WordPress/wp-content/* wp-content
cp -p /WordPress/wp-config.php .htaccess ./

Now we rename the old WordPress directory to something else and the new one to what the old one was called.

mv /WordPress /WordPress.bak
mv wp /WordPress

That’s it. Check that your blog is still working, if something went wrong you can just revert to the old version by doing the last commands the other way around:

mv /WordPress /wp
mv /WordPress.bak /WordPress

From now on, you can easily update using the following command (changing the “2.5.1” part to the appropriate version, of course):

svn sw http://svn.automattic.com/wordpress/tags/2.5.1/

It sure is a complicated process if you don’t have much terminal / shell / ssh experience, but it’s definitely worth the effort.


Comments are closed.