Monday, June 25, 2012

How to Upgrade WordPress installation via SSH?

WordPress is the most widely hacked script and thus; we will have to update wordpress. Most of the users do it from WordPress dashboard but if you have a server and have root access then you do via shell access. If you haven't root access then you will have to ask your provider to enable shell access for you.
you will have to login to your server
ssh user@mydomain.com
on the command line, and after that you’ll be prompted to put your password. Usually the user and password are the same of your FTP account, but they might be different.
Once you are logged in you need to browse to your public_html directory, which is usually where WordPress is installed. If you are using a sub-directory, navigate to it. Then type this to download the latest WordPress files:
wget http://wordpress.org/latest.tar.gz
After that type this to decompress the file:
tar xfz latest.tar.gz
Next we need to delete the wp-admin and wp-includes directories, which you can do with the following commands:
rm -rf ./wp-includes
rm -rf ./wp-admin
Now you want to move the new wp-admin and wp-include directories to the root, so type the following commands:
mv ./wordpress/wp-admin ./
mv ./wordpress/wp-includes ./
Finally, go inside the WordPress directory with
cd wordpress
and copy its content to the parent directory (i.e., the root) overwriting the old ones:
cp -rpf -f * ../
Finally, type “cd ..” to go back to the root directory and delete both the tar file you downloaded and the wordpress directory with this:
rm -rf ./wordpress/
rm -f latest.tar.gz

Recent Posts