INSTALLING WITH SUBVERSION
If you have shell access to your web server, you can use a different technique for installing and updating WordPress. This technique uses a tool called Subversion to automatically download and install the WordPress files on your web server.
The really useful part is that you can use Subversion to seamlessly upgrade your WordPress installation to the latest version, which helps to keep your copy of WordPress secure. This technique will just install or update the core Wordpress files. Use the built-in WordPress system for installing and updating themes and plugins.
From The Wikipedia Subversion Page:
"Apache Subversion (often abbreviated SVN, after the command name svn) is a software versioning and a revision control system founded and sponsored in 2000 by CollabNet Inc. Developers use Subversion to maintain current and historical versions of files such as source code, web pages, and documentation. Its goal is to be a mostly-compatible successor to the widely used Concurrent Versions System (CVS)."
Although Subversion is mostly used by developers, it can also come in handy for normal users who need to keep their files up to date with a remote repository. In this case, it makes installing and updating a WordPress site really quite simple.
Getting started with Subversion
The first step is to check that you have command line (or shell) access to your website.
You should be familiar with the Secure Shell (or SSH) command. To connect to your web server you would issue a command like:
$ ssh -v -C you@yourdomain.com
In the example above, you should substitute your own username and the correct domain you use for accessing your web server.
The "-v" switch tells SSH to print messages so you can see what is happening, and the "-C" turns on compression to speed things up over slow connections.
For more useful information on SSH, see :
http://en.wikibooks.org/wiki/Internet_Technologies/SSH
Once you are connected to your web server, you need to check to see if Subversion is installed. To check, issue the following command:
$ which svn
If Subversion is installed, you should see something like:
$ /usr/bin/svn
If you don't see anything, it means that Subversion is not installed on the web server. In that case you need to contact an administrator and ask them to install it for you. If you have the administrator (or root) password for your Debian GNU/Linux based web server you can install Subversion by issuing the following command (as root):
$ apt-get install svn
We will now assume that you have successfully connected to your web server with SSH and have Subversion installed.
Installing WordPress with Subversion
The first thing you need to do is decide where you want to install WordPress.
WordPress needs to be installed into a directory on the web server machine that the web server software has access to. On GNU/Linux servers running Debian based distributions, it is common for the directory to be named 'public_html'.
If you need to, create the directory:
$ mkdir public_html
Now change into the new directory:
$ cd public_html
You are now almost ready to use Subversion to install WordPress - but first you need to choose which version to install. There are two main options - "trunk" or "stable". In WordPress parlance, "trunk" represents the very latest "bleeding edge" version of the software. For our purposes, you will probably want to install the "stable" version instead.
To find the latest version, check http://core.svn.wordpress.org/tags/
At the time of writing, the latest stable version is 3.2.1
To install a fresh copy of WordPress 3.2.1 using Subversion:
$ svn co http://core.svn.wordpress.org/tags/3.2.1 .
Let's have a closer look at the command above. The first part, "svn", is the subversion command itself; "co" stands for "check out". "http://core.svn.wordpress.org/tags/3.2.1" is the URL of the version of WordPress we are checking out, and finally the "." fullstop (or period) tells Subversion to install the files into the current working directory. Don't forget the fullstop or the command won't work!
Once you run this command, you will see a lot of information scroll past as Subversion connects to the remote hosts and copies all of the necessary files to your web server. When finished, you will see a message like:
Checked out revision 18636.
This means that the Subversion Checkout process has completed successfully. You now need to finish the installation by editing wp-config-sample.php
to add to your database details. Save the file as:
wp-config.php
Now visit your blog URL to finish the install, just a like a standard WordPress install.
Updating WordPress with Subversion
Subversion makes updating WordPress really straightforward. To update your WordPress installation (once connected to your web server with SSH):
Check the latest available version of Wordpress here:
http://core.svn.wordpress.org/tags/
Change to the WordPress directory:
$ cd public_html
Instead of "Checkout", we use the Subversion switch (sw) command when updating.
Issue the following command, substituting "3.2.1" for the version you wish to upgrade to:
$ svn sw http://core.svn.wordpress.org/tags/3.2.1/ .
This will automatically upgrade WordPress while leaving custom or edited files like wp-config.php and your plugins untouched.
Once Subversion has done it's thing, visit:
http://www.yourdomain.com/wp-admin/upgrade.php
Converting a traditional WordPress install
If you have a pre-existing WordPress install that you would like to update using Subversion, you will first need to convert it by following these steps:
- Make a backup of your files and database and disable all plugins first.
- Create a new temporary directory.
- Use the Subversion commands from above to checkout WordPress (trunk or stable version) into it.
- Copy all your custom files from the existing WordPress location to the temporary directory. This includes config files, plugins and images or media files.
- Rename the temporary directory to match the old directory name.
- Run the WordPress update script (by going to your admin page - /wp-admin/) and test everything.