Performing WordPress upgrades (Linux)
Note: Remember to always refer to the official upgrade guide. This is by no means official, but it has worked for me. I’ve tried to keep it as short and easy as possible.
Another Note: WordPress 2.7 comes out on November 10th. It will have an automatic updater module – so you probably won’t have to worry about this kind of thing again after that!
Versions tested with:
Obtain the path to your wordpress installation, we’ll assume it’s
Safety first. Always.
So make a backup of your WordPress installation folder:
cp -rp /home/user/www/blog /home/user/www/blog.backup
Next, you’ll want to make a backup of your MySQL database associated with it.
Refer to my Simple MySQL backup script to see how to do it.
You’re good to go now – you’ll be able to revert any changes you’ve made if you have to. (And that’s a nice fuzzy feeling)
Let’s get busy:
- Make an update directory to copy new files from
- Get latest WordPress zip file
1 2 3 4
mkdir /home/user/www/blog/update cd /home/user/www/blog/update wget http://wordpress.org/latest.zip unzip latest.zip
Just to keep things clear, we have 2 directories at this point:
Delete your old wp-includes and wp-admin directories (I rename them here, which has the same effect).
1 2 3 4 5
mv wp-includes wp-includes.old mv wp-admin wp-admin.old mkdir wp-includes mkdir wp-admin
Copy over the new files (NOTE that I haven’t used the ‘-rp’ flag for the last copy command):
1 2 3 4 5
cp -rp /home/user/www/blog/update/wordpress/wp-includes/* ./wp-includes/ cp -rp /home/user/www/blog/update/wordpress/wp-admin/* ./wp-admin/ cp -rp /home/user/www/blog/update/wordpress/wp-content/* ./wp-content/ cp /home/user/www/blog/update/wordpress/*.php ./
Log-in to your admin-page. If WordPress needs to perform a database upgrade, it will do it for you.
Check that all your plugins are enabled and in proper working condition.
Optional: After you’ve tested everything and you’re happy with the upgrade, you should delete all the extra files:
1 2 3 4
rm -r /home/user/www/blog/wp-includes.old/ rm -r /home/user/www/blog/wp-admin.old/ rm -r /home/user/www/blog/update/ rm -r /home/user/www/blog.backup/