# Remove/reinstall apache2



## weslee (Apr 11, 2004)

I am running debian.

I tried installing php5-gd and it broke my apache2 configuration.

How can I completely wipe apache2, mysql, and php5 off my system so that I can do a complete reinstall?

In my attempt on all this, I ended up deleting /etc/apache2 hoping for an "apt-get install apache2" to reinstall files to that directory. Things didn't go that way though, and now I have no "/etc/apache2" directory!

Any help/ideas?

Wes


----------



## fenderfreek (Mar 14, 2006)

Best way to do a clean uninstall is to use

```
apt-get purge <package>
```
That will completely remove the package AND it's configuration files.


----------



## weslee (Apr 11, 2004)

Are you talking about

```
dpkg --purge <package>
```
?

This

```
apt-get purge <package>
```
 does not work. There is no "purge" option for "apt-get"

I tried "dpkg --purge <apache2 packages>" and then did an "apt-get install apache2 apache2.2-common apache2-utils" and it did reinstall an apache2 folder in /etc but that folder did not contain an apache2.conf file. In other words, the reinstall only did half its job.


----------



## fenderfreek (Mar 14, 2006)

You are right. I'm not sure what I was thinking, but when I did some looking, apparently you can also use

```
apt-get remove --purge <package>
```
 and it will clean a package completely. As for the half-install, you've got me there. Maybe someone else on here can offer some help with that.


----------



## weslee (Apr 11, 2004)

Well.. after doing a COMPLETE dpkg --purge of ALL related apache2 packages, and after reinstalling everything, I did get an apache2.conf file to show up... the problem now, however, is that when the server gets started (runs without errors), my browser just hangs as if waiting for content... the content should simply be a print out of directories in the var/www folder (i haven no index file in there). No idea now why the server hangs... like I said, it starts fine, but won't send data (or something). I'll probably format that hard drive and reinstall linux.


----------

