How to: WordPress 2.3 upgrade via SVN on Mediatemple Grid Server

Posted September 24, 2007 // Tagged as Tutorials // 5 Comments ↓

It’s about that time of the week when I am feeling invincible and somewhat foolhardy, so I decided I would bring this blog up-to date and install the current release candidate (2.3-RC1) of WordPress.

Rather than have to do a manual upgrade with every new release (even though the WordPress automatic upgrade plugin worked quite well) I thought that I would follow in the foot steps of others and set up a new WordPress installation that I could quickly upgrade using Subversion.

The steps to do this have been documented on the WordPress codex site, but I will target them towards the Mediatemple girdserver and go through the steps I took to enable this blog for subversion updates.

Note: You will need to enable ssh access on your Grid server account to follow these steps. To do that login to your Mediatemple control panel, go to the Server administrator section and scroll down the section labeled SSH option. Make sure this is set to Enabled and save your changes.

Note 2: If you are not comfortable using the command line, then I can recommend using this plugin instead.

Step 1 - Create a new blog directory

Open a terminal window on your computer (Mac and Linux users can use the default terminal application, Windows users will have to download and install one) and connect to your server.

ssh serveradmin%my-domain-temple.com@my-domain-temple.com

replacing the serveradmin%my-domain-temple.com with your administrator username and @my-domain-temple.com with your domain name.

Once logged in you will need to go to the domains directory of your hosting account, and make a temporary blog directory. This blog uses sub-domains (blog.clearskys.net), so I am going to create a new temporary sub-domain to hold the new upgraded site.

cd domains
mkdir newblog.mydomain.com
cd newblog.mydomain.com
mkdir html
cd html

Step 2 - Getting the latest WordPress code.

The Gridserver on Mediatemple has SVN already installed. So all we need to do now is grab the latest version of WordPress from it’s Subversion repository. For the purposes of this next step I am going to grab the Trunk version of WordPress, this is the most up to date, but can also be buggy as it is where the ongoing development takes place. If you would rather use a more stable release, you can replace this next line with the example given later.

svn co http://svn.automattic.com/wordpress/trunk/ .

Make sure that you have the trailing slash and the . to ensure that the files are copied to the current directory.

Step 3. Transfer old themes and plugins across to the new location

Now that we have our most recent version of WordPress downloaded, we need to copy across our themes, plugins and graphic files. These are usually stored in the wp-content directory of your current blog. So let’s copy those across to the new site.

cd ../../myblog.mydomain.com/html
cp -rpf wp-content/* ../../newblog.mydomain.com/html/wp-content

And finally, we need to copy across our current configuration and .htaccess files.

cp -p wp-config.php .htaccess ../../newblog.mydomain.com/html

Step 4 - Backup your database

At this stage we should have a copy of all the files from our existing blog installation in the directory for the new upgraded blog. The new blog can’t be used yet, however, as we haven’t upgraded the database with any changes that the new version requires, so before we continue you should login to phpMyAdmin (or use the Mediatemple backup system on your control panel) and take a backup of the database.

Step 5 - Rename directories and upgrade the database

Now to the final step, you should complete this at a time when your blog isn’t busy with a lot of traffic as your site will be offline for a few seconds.

First we need to switch your current blog to the newly setup one by renaming the directories.

cd ../..
mv myblog.mydomain.com myoldblog.mydomain.com
mv newblog.mydomain.com myblog.mydomain.com

And finally we upgrade the database, in your browser go to the following URL (you will need to change the domain to the one for your blog).

http://myblog.mydomain.com/wp-admin/upgrade.php

Keeping your blog up to date.

From this point onwards you can upgrade the core WordPress files for your blog by logging into your webserver (again using SSH as above), navigating to your blog directory and running the SVN update command.

cd domains/myblog.mydomain.com/html
svn up

and that is all there is to it, other than running the update.php file again to keep your database in sync.

Using the stable version of WordPress rather than the development version.

If you aren’t brave enough to run your blog off the most up to date development version of WordPress you can make a couple of small changes to the SVN commands used above. Assuming we want to install the 2.2.3 version of WordPress we would run the following command.

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

If we want to upgrade to a newer stable version, then we would run the following command, instead of the “svn up” line above.

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

Note: the above version doesn’t exist, so don’t try that line.

I hope you find these instructions useful, I am sure that they will help you from the painful process of upgrading your blog using FTP from this point on.

I must stress, however, that if you are not at all comfortable with the command line then don’t try the steps above, but if you do venture forward then make sure you take a backup of your blog and database first.

5 Responses

  1. [...] « How to: WordPress 2.3 upgrade via SVN on Mediatemple Grid Server [...]

  2. futtta

    September 28th, 2007 at 9:21 pm

    i wrote a wp upgrade shell script which takes care of upgrading to the latest stable version: it makes a backup of the wp-db and -fs, turns of plugins and syncs with the latest tagged version using “svn sw”.

    you can fetch a tar.gz-version of it on http://futtta.be/download/WPuppy.tar.gz.

    more info (in dutch, but there’s an auto translate link in the upper right corner) on: http://blog.futtta.be/2007/09/26/wordpress-automagisch-upgraden-nu-ook-met-hondje/

  3. Sam

    November 22nd, 2007 at 8:09 am

    Awesome writeup! I like how this method wasn’t as daunting as the procedure on Wordpress, and how you were able to save a backup of your old install just in case.
    Thanks again.

  4. [...] How to: WordPress 2.3 upgrade via SVN on Mediatemple Grid Server [...]

  5. Kristen

    April 3rd, 2008 at 6:43 pm

    This post was really helpful to me, thank you so much for such clear instructions.

Leave a Reply