How to use SVN to update WordPress

Making it Work

If you wish, put up an .htaccess to redirect all requests for your blog to a construction page. But frankly, your blog will be down for such a short period of time that I don’t think it’s worth it.

  1. Log in via SSH and cd to your root directory. It is usually called public_html or www. (See Basic Linux Commands to get a handle on cd, ls, mv, cp, and rm.)
  2. Issue the ls command to make sure you can see your blog directory. I will assume it is called blog. If you see your blog, good. You’re in the right directory.
  3. Issue the command mv blog/ blog.bak/ to move your (working) blog to a backup directory. If something goes wrong, you’ll have a working copy to restore to.
  4. Now make a new blog directory and move into it with the command mkdir blog && cd blog.
  5. You’re ready to check out a fresh copy of WordPress. The current SVN command to use, as found on the WordPress SVN page, is:

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

  1. cd ../blog.bak/ will move you into your old (working) blog. If you’ve done things right, you should only have a few files to move.
    1. cp wp-config.php ../blog/ for your config file.
    2. cp -R wp-content/themes/yourtheme/ ../blog/wp-content/themes/ will copy your custom theme over. Notice the -R switch, which is needed to copy a directory.
    3. cp wp-content/plugins/yourplugin.php ../blog/wp-content/plugins/ for each plugin you have.

You should now have a working WordPress install, from SVN, completely up-to-date.

The next time a WordPress update is released, cd to your blog’s folder and issue the command svn up and WordPress will automatically be updated to the latest version! That time savings makes setting up SVN completely worthwhile.

Dewdles by Sam