web analytics

Blog

WordPress Upgrade or Reinstall using SSH

Tags: reinstallUpgradewordpress

Published on: February 2, 2016 by Felix

WordPress Upgrade or Reinstall using SSH

Scenario:

Automated WordPress upgrade may not work always. In such cases, we may need to do WordPress upgrade manually or reinstall the existing installation and perform it as a step by step process.

Sometimes a failed upgrade or file corruption may occur in your current installation. You can follow the below steps for resolving such issues also.

Here I am trying to explain the steps involved with manual WordPress upgrade without affecting the websites contents.

Before proceeding take necessary precautions to avoid a data loss.

Take a backup of the website including its files and database before proceeding.

 

Legend

WordPress Domain’s document root :  /home/felix/public_html/mydomain/

Extracted WordPress directory from WordPress package ‘ latest.zip ‘ :

/home/felix/public_html/mydomain/wordpress

Requirements

SSH access to your website’s document root.

 

Steps to be followed

1. Download the latest WordPress package ‘ latest.zip ‘ in the Domain’s document root.

In this example its ‘ /home/felix/public_html/mydomain/ ‘ .

root@training1 [/home/felix/public_html/mydomain]
# wget --no-check-certificate http://wordpress.org/latest.zip
100%[============================================================================================>;] 6,586,773 1.86M/s in 3.5s
2014-12-16 20:48:18 (1.78 MB/s) - “latest.zip” saved [6586773/6586773]

Extracted directory would be in the name ‘wordpress/’ .

root@training1 [/home/felix/public_html/mydomain]# unzip latest.zip

root@training1 [/home/felix/public_html/mydomain]# ll -d wordpress
drwxr-xr-x 5 root root 4096 Dec 16 20:55 wordpress/

2. Rename the wp-content Folder in the extracted directory ‘ wordpress/ ‘ so that the current one doesn’t get replaced.

 
root@training1 [/home/felix/public_html/mydomain]# cd mywordpress/ 
root@training1 [/home/felix/public_html/mydomain/mywordpress]
# mv wp-content/ wp-content.default 

3. Take a backup of your db. You can use PhpMyAdmin or mysqldump for the process


#mysqldump dbname > dbname.sql;

4. Copy Files/Folders from new ( wordpress/ ) to old WP installation ( mydomain/ ) .

root@training1 [/home/felix/public_html/]
# /bin/cp -Rv mydomain/wordpress/* mydomain/ 

Using the command ‘ /bin/cp ‘ will forcefully copy without asking for confirmation so be cautious

5.  Finally you can execute the following command to ensure all the Files/Folders are in the right ownership. ( Note that felix is the user in this example )

 
root@training1 [/home/felix/public_html]
# chown -R felix.felix mydomain/* 

7. If you had an older WordPress version in the domain, you can see the following page when accessing the website or when logging into WordPress Admin since it has been upgraded.

wordpress

6. Just click the update button and you will see the below confirmation page.

wordpress2

You have re-installed WordPress successfully 🙂

 

Theme/Plugin Issues

7. You can see  two ‘ wp-content ‘ folders in your document root.

root@training1 [/home/felix/public_html/mydomain]# ll
wp-content/
wp-content.default/ 

Here wp-content.default is the default one which we downloaded earlier. Sometimes you may experience issues with the current theme or plugins.

If the existing installation is configured with default themes/plugins which throws errors, you may replace theme/plugin folders with the corresponding folders present in the wp-content.default/ folder.

root@training1 [/home/felix/public_html/mydomain]
# /bin/cp -Rv wp-content.default/* wp-content/

If you are having issues in Custom Themes, you may have to re-upload them. Note that when re-installing theme/plugin, custom settings may get lost.

Category : Linux, WordPress

Felix

Felix

Firaz has been in the Web Hosting industry since 2012. He is always fascinated in resolving complicated DNS, cPanel and other Web hosting issues. He loves to help newbies to climb the hill from a fresher to an experienced System admin. Movies and songs are his favourite passtime.

You may also read:

Comments

Add new commentSIGN IN

Let's Connect

Get new updates

Categories

$0.000 items