Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question
    
/etc/apache2/envvars is in apache2.2-common, have you reinstalled that package too? Like with command sudo apt-get --reinstall install apache2.2-common –  LGB Feb 14 '11 at 7:07
add comment

4 Answers 4

up vote 33 down vote accepted

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.

share|improve this answer
    
This also doesn't work. It says that apache2 is already installed and the purge doesn't remove the config file in etc/apache2. In fact the purge complains that it can't envvars too. –  seadowg Feb 14 '11 at 10:31
    
Has reinstalling apache2.2-common with the option about to replace missing conf files worked for you? –  ajmitch Feb 17 '11 at 0:51
    
Almost a year later and found this, thank you very much. –  nerdwaller Dec 6 '12 at 16:35
1  
helped a lot, but package apache2.2-common doesn't exist anymore....did the same sequence just with package apache2 –  Jürgen Zornig Jun 20 at 7:20
add comment

run the following command first

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

then run

sudo apt-get install apache2

it worked for me

share|improve this answer
1  
This will delete all your apache configs. :( –  tokam Dec 5 '13 at 12:45
    
@tokam Yes, see the question. –  Felix Rabe Apr 1 at 7:11
add comment

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
share|improve this answer
add comment

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
share|improve this answer
add comment

protected by Braiam Jan 23 at 13:24

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.