Since the release of 2.1 we have seen two upgrades in little over a month and upgrading WordPress can be a real pain in the neck. It becomes really bad when you’re talking about upgrading more than one blog.
For those who have shell access upgrading WordPress can be a lot less painful and this guide hopes to set you establish just that. I upgraded three installations in less than fifteen minutes. It would have been faster but I am sure I saved a great more time had I to do it the hard way!
Firstly, make sure you backup your installation. There are a lot of guides explaining this, so I won’t go into detail, unless you want me to.
Once, the database is backed up, login to your account via shell and navigate to the folder of your WordPress installation. Mine is installed in
Once in there run the following commands (read the notes at the end first):
wget http://wordpress.org/latest.tar.gz tar xfz latest.tar.gz rm -rf ./wp-includes/ rm -rf ./wp-admin/ cd wordpress/ cp -rpf ----reply=yes * ../ cd .. rm -rf ./wordpress/ rm -f latest.tar.gz
The above commands will fetch the latest WordPress installation and untar it. It then deletes
wp-admin and all its subfolders and files. If you have modified any files in there, you will need to make the modifications again.
We then copy the newly downloaded files to your existing WordPress installation.
The untarred files and the downloaded .tar.gz file are deleted.
After running the command above, run the upgrade file in
/wp-admin/upgrade.php in your browser.
While this guide will work with just about any WordPress upgrade, I advise you to use it only for minor updates. When making a major upgrade, say from 2.0 to 2.1, it is advisable to delete all the old WordPress files before moving the new ones.
I haven’t touched
wp-content and its subfolders above to ensure your existing files, plugins and themes are not effected. Any new files, plugins and themes that come bundled with the new version of WordPress will overwrite the existing ones.
Ohh… and tell me how much time this has saved you.
- The code above will work only on a Linux / Unix server.
- I’ve been informed that the
--replymay not work/be needed on certain Linux installations.
- It also assumes that you are logging in to the shell via your own account. If you login via
root, the permissions will change and you will need to run
chown -R username *(change username to the account owner’s username) to correct the permissions. This can cause problems with WP-Cache, so you will need to reinstall the plugin again.
- If you are using translations, please backup
wp-includes/languagesbefore running the commands above.
Disclaimer: Make sure you backup your installation. I won’t be held responsible if something goes wrong when you follow this guide.