Uninstall Apache

So, I’m sure many others have made the same mistake. You downloaded the latest Apache, did the 3 step:

  1. configure –prefix=/usr/local –enable-mods-shared=all –enable-ssl –enable-proxy
  2. make
  3. sudo make install

Doh! That’s probably not what you wanted. Now you have stuff like

  • /usr/local/build
  • /usr/local/icons

You’d have been better off going with Apache 2’s default prefix which is /usr/local/apache2. The problem is there’s no uninstall! If that’s happened to you and you just made the mistake a short time ago, try this:

  1. Make sure you have enough free space for a backup of /usr/local

    $ sudo du -sh /usr/local
    2.2G /usr/local

    $ df -h

  2. Back it up

    $ tar cvf /tmp/usr_local.tar /usr/local

  3. Find out which files you just installed

    $ sudo find . -type f -newerct ‘60 minutes ago’ > /tmp/uninstall_files.txt

    $ sudo find . -type d -newerct ‘60 minutes ago’ > /tmp/uninstall_dirs.txt

  4. Inspect the file you just created and remove things that don’t belong (e.g. mysql)
  5. Remove the files (don’t get creative and add -r to rm — you did backup, right?)

    $ cat uninstall_files.txt | sudo xargs rm

    $ cat uninstall_dirs.txt | sudo xargs rmdir

Now, take off that prefix and try the 3-step again.

Leave a Reply