How to upgrade wordpress manually

Recently I upgraded wordpress from version 3.5.1 to 4.3.1. There are couple of ways you can upgrade wordpress and easiest one is do it using the wordpress ui. It pretty much involves few clicks if things go smoothly. For me it did not work from ui as it got stuck at unpacking stage. These are the quick manual steps which worked for me (on Ubuntu Linux). These were based on the upgrade instructions on wordpress site.

Take code and db backup

Take a backup of your wordpress directory. Assuming it is installed at /var/www/html/wordpress, run the following

$ cd /var/www/html/
$ sudo rsync -a /var/www/html/wordpress /var/www/html/wordpress.bak

rsync -a will ensure file permissions are also preserved.
Now take a backup of mysql db.

$ mysqldump -u root --password=ROOT_PASSWORD -h localhost DBNAME > db.bak

Deactivate all plugins

First deactivate all plugins. Before deactivating, note down any already deactivated plugin. This will be useful when you want to activate these plugins again.

Delete some old wordpress code

Run the following to delete old code

$ cd /var/www/html/wordpress/
$ sudo rm -rf wp-content/cache/*
$ sudo rm -rf wp-includes
$ sudo rm -rf wp-admin
$ sudo rm index.php wp-activate.php wp-activate.php wp-config-sample.php  wp-login.php wp-mail.php wp-blog-header.php license.txt xmlrpc.php wp-signup.php wp-settings.php wp-load.php wp-trackback.php wp-links-opml.php readme.html wp-cron.php wp-comments-post.php

We will keep wp-config.php file and wp-content directory unchanged.

Download latest wordpress

Down the latest wordpress software and unzip it to ~/software/wordpress-latest or some other location. Now copy the relevant files from it to the installation directory of wordpress.

$ cd /var/www/html/wordpress/
$ rsync -a --exclude=wp-content ~/software/wordpress-latest/* ./

Upgrade wordpress

Now visit /wp-admin/upgrade.php in browser and follow instructions to upgrade the wordpress db. You will see a screen as shown below:
wordpress-update-db-screen
Click on “Upgrade WordPress Database” to finish the upgrade.

Now login to /wp-admin and then activate previously deactivated plugins.

Share this article: share on Google+ share on facebook share on linkedin tweet this submit to reddit

Comments

Click here to write/view comments