Delete WordPress from Server
Why do you need to delete WordPress from your Virtual Priver Server (VPS) or hosting service? Maybe it's been custom patched too many times, and you want a fresh install, deleting the Wordpress site and starting over. Maybe you've woken up to the fact that a WordPress based website just requires too much maintenance, and you've gone for a simplier Content Management System (CMS). Maybe you've moved your website to another provider and you want the comfort that you've obliterated the old hosted one. Whatever the reason this article shows how to delete WordPress and the database engine setup on a CentOS VPS. The article assumes you are accessing the VPS over SSH. If you have access to a Control Panel for your website it might be easier to delete WordPress using that. This article is aimed at those who only have SSH access and know how to access their VPS or hosting account via SSH. The commands here were tested on a CentOS 7 based VPS running WordPress on a MariaDB database.
Note: This article is for information only. You are responsible for you own actions and need to ensure you have a backup of any data that may be deleted. If unsure of the actions presented here practice the commands on a test setup or seek the advice of a qualified technician.
Backup the Website Data
If you need the website files it is important to backup your server. One way of preserving the WordPress data is to use the WordPress Export option. This is useful if doing a fresh WordPress install or moving to a new WordPress location.
Delete the WordPress Files
Once logged into the VPS or server over SSH go to the WordPress hosting directory. Note: Your virtual hosting directory may be in a different location. If in doubt check with your hosting provider:
# cd /var/www/html
Next recursively delete all the files and directories (this command is dangerous, hence changing to the specific directory first):
# rm -rf *
And return to the home directory if required:
Optionally Completely Remove the Database Server
To remove MariaDB from the CentOS 7 VPS:
# yum remove mariadb-server
Clean away the MariaDB configuration files. If your datadir in /etc/my.cnf points to a different location, remove that directory, instead of
# rm -rf /var/lib/mysql # rm /etc/my.cnf
Also optionally (if
# rm ~/.my.cnf
Author:Daniel S. Fowler Published: