I wanted to completely blow away owncloud on one of my Debian servers today. I did apt-get remove owncloud and removed the owncloud directory. That should be all I need to do, right? Alas, not so.
It turns out that a simple apt-get remove does not remove necessary files, and a simple apt-get install doesn’t restore those missing files. In order to completely blow away the package, you must use the purge command (thanks to this site for the inspiration.)
First, purge the package as well as related packages
sudo apt-get purge owncloud-*
Then, re-install the package with the –reinstall flag
sudo apt-get install --reinstall owncloud
Done! The package has come back anew with all necessary files.