This shows you the differences between two versions of the page.

Link to this comparison view

tech:linux:upgrading_wordpress_sites [2014/11/15 09:13] (current)
Line 1: Line 1:
 +====== Upgrading WordPress websites ======
 +This is slightly different from the standard instructions although most of the standard instructions will apply. It is different because
 +  * The way I have installed WordPress is to enable it from a single install path for all websites
 +  * And also to use a single MySQL database for all installs with just table prefix being different
 +Please refer to [[tech:​linux:​creating_wordpress_websites_on_ub1|Creating WordPress Websites]] for adding new WordPress websites
 +To do the manual upgrade usually requires you simply overwrite the new WP files. Check the latest version upgrade instructions to be sure. Once that is done you can log on to each site and click upgrade to upgrade the database. Below is a SQL script to help you check the version of all your wordpress sites
 +==== Checking the version of all the wordpress sites ====
 +Use this SQL to check in one go. Include more lines as required of course!
 +<code sql>
 +select '​wp01_options'​ table_name, option_value from wp01_options where option_name = '​db_version'​
 +union all
 +select '​wp02_options'​ table_name, option_value from wp02_options where option_name = '​db_version'​
 +union all
 +select '​wp03_options'​ table_name, option_value from wp03_options where option_name = '​db_version'​
 +union all
 +select '​wp04_options'​ table_name, option_value from wp04_options where option_name = '​db_version'​
 +union all
 +select '​wp05_options'​ table_name, option_value from wp05_options where option_name = '​db_version'​
 +union all
 +select '​wp06_options'​ table_name, option_value from wp06_options where option_name = '​db_version'​
 +union all
 +select '​wp07_options'​ table_name, option_value from wp07_options where option_name = '​db_version'​
 +union all
 +select '​wp10_options'​ table_name, option_value from wp10_options where option_name = '​db_version'​
 +union all
 +select '​wp11_options'​ table_name, option_value from wp11_options where option_name = '​db_version';​
 +===== Steps =====
 +Below are steps to completing the upgrade
 +==== Download latest WordPress ====
 +  * Go to the path of your WordPress current install. Let's assume this is /​www/​path/​to/​wordpress
 +  * Note you will need to be ONE DIRECTORY ABOVE this path
 +  * Do <code bash>cd /​www/​path/​to/​wordpress/​..</​code>​
 +  * Remove any old downloads <code bash>rm latest*.zip</​code>​
 +  * The latest release of WordPress is usually at "​http://​wordpress.org/​latest.zip",​ so do a <code bash>​wget "​http://​wordpress.org/​latest.zip"</​code>​
 +==== Follow instructions to upgrade ====
 +  * The latest (at this writing 3.0.4) required delete of the old wp-includes and wp-admin directories,​ so let's do that as follows. There is a catch to this step as my WordPress script is under svn.  Also the instructions below don't delete the directories themselves. If they happen to be extra there is very minimal chance that this will affect WordPress working in anyway. For that matter even left over files should not be a problem and you can probably skip these steps entirely. Refer [[http://​codex.wordpress.org/​Upgrading_WordPress|Upgrading WordPress]]
 +    * Run<code bash>cd wordpress/​wp-includes</​code>​
 +    * Run<code bash>​find .|grep -v "​\.svn"​|xargs rm</​code>​
 +    * Run<code bash>cd ../​wp-admin</​code>​
 +    * Run<code bash>​find .|grep -v "​\.svn"​|xargs rm</​code>​
 +  * Back to root folder (/​www/​path/​to) <code bash>cd ../​..</​code>​
 +  * Run the unzip to overwrite the files. Accept when prompted for overwrite <code bash>​unzip latest.zip</​code>​
 +==== View and commit all changes ====
 +  * Go to the wordpress directory which now has all the new files <code bash>cd wordpress</​code>​
 +  * Run <code bash>svn status</​code>​
 +  * Do a svn delete for those files with an "​!"​ and then run svn commit, below are the steps
 +    * For svn deleting files that have been O/S deleted Run <code bash>svn status|grep "​^\!"​|awk '​{print $2}'​|xargs svn del</​code>​
 +  * For adding new files do <code bash>svn status|grep "​^?"​|awk '​{print $2}'​|xargs svn add</​code>​
 +  * Do Commit <code bash>svn commit -m "​Upgraded WordPress"</​code>​
 +  * Make sure you set permissions back on WordPress Directory depending if you did this as root or a non-apache user
 +    * Back to root folder (/​www/​path/​to)
 +    * <code bash>cd ..</​code>​
 +    * <code bash>​chown -R www-data:​www-data wordpress</​code>​
 +==== Upgrade the Blog database ====
 +  * Go to the admin URL of the wordpress site and complete the upgrade which will upgrade the database for the blog
 +  * Repeat above step for each blog

QR Code
QR Code tech:linux:upgrading_wordpress_sites (generated for current page)