44

I recently was messing around with my Apache config and wanted to reinstall so I could start from fresh. I followed some forum posts about reinstalling the apache2 package and this ended up deleting my /etc/apache2 folder.

Now matter how many things I try I can't seem to do a full wipe of the Apache install and then reinstall. sudo apt-get install apache2 or reinstall doesn't do anything. I can't seem to remove it using Synaptic either.

Is there anything I can do to have a fresh Apache install on my computer again?

lofidevops
  • 21,912
seadowg
  • 575

4 Answers4

83

To replace configuration files that have been deleted, without purging the package, you can do

sudo apt-get -o DPkg::Options::="--force-confmiss" --reinstall install apache2

To fully remove the apache2 config files, you should

sudo apt-get purge apache2

which will then let you reinstall it in the usual way with

sudo apt-get install apache2

Purge is required to remove all the config files - if you delete the config files but only remove the package, then this is remembered & missing config files are not reinstalled by default.

jmunsch
  • 2,293
  • 1
  • 24
  • 30
ajmitch
  • 18,999
6

run the following command first

sudo apt-get remove --purge apache2 apache2-utils

then run

sudo apt-get install apache2

it worked for me

N.N.
  • 18,589
edd
  • 77
  • 1
  • 1
2

Remove Apache2 files...

sudo apt-get remove --purge apache2*

Clean install

sudo apt-get --reinstall install apache2.2-common
sudo apt-get --reinstall install apache2
kiri
  • 28,986
Fox
  • 49
-1

try this

apt-get -f install

then run

sudo apt-get install apache2

Edit: or possibly

sudo apt-get purge apache2
sudo apt-get install apache2
fabricator4
  • 8,471
  • 1
  • 37
  • 39
Ahmed
  • 15