Upgrading WordPress Via SSH
Updating to a newer version of WordPress couldn’t be any simpler for most users! Just log into the dashboard, select the option to update right under ‘Updates’, and in just 10 seconds or so, you’ll be done and ready to start blogging again in no time.
However, there are still some cases wherein an automatic update simply will not work because of current server settings. These are instances when you’ll just have to update manually, which means deleting and uploading the files via FTP, a process that’ll take around 15 minutes with an average Internet connection.
Fortunately, there’s a much better alternative and it’s called SSH (which stands for Secure Shell), a protocol for remote communications. Using this allows you to connect to your server and perform commands as if you were personally using the computer.
So how would you go about using this process? First you have to make sure that you have SSH enabled on your account (you can do so by contacting your hosting provider). Once you’ve confirmed this, just login to your server by typing the following on the command line:
ssh [email protected]
You’ll then be prompted for your password. Usually the user and password are the same as your FTP account BUT they might still be entirely different.
After you’re logged in, browse to the public_html directory, the folder where WordPress is usually installed (if you’re using a sub-directory, navigate to it). Once there, type the following command to download the latest WordPress files:
wget http://wordpress.org/latest.tar.gz
After downloading, decompress the file with this command:
tar xfz latest.tar.gz
Next, you’ll need to delete the wp-admin and wp-includes directories. To do this, type the following:
rm -rf ./wp-includes rm -rf ./wp-admin
Now you’re going to move the new wp-admin and wp-include directories to the root by typing these:
mv ./wordpress/wp-admin ./ mv ./wordpress/wp-includes ./
Then go inside the WordPress directory by typing “cd wordpress” and copy its content to the parent directory (i.e., the root) overwriting the old ones with:
cp -rpf -f * ../
Finally, go back to the root directory by typing “cd..” and delete both the tar file you downloaded and the wordpress directory:
rm -rf ./wordpress/ rm -f latest.tar.gz
After all that, all you have to do is run the upgrade script on your WordPress install (i.e., domain.com/wp-admin/updgraded.php) and that’s pretty much it. You’re done!
Credit to Daniel Scocco for sharing this helpful tutorial.