Error installing Apache2 Server

I'm trying to install apache2 server, but it gives following error message:

It looks like you've deleted /etc/apache2/mods-available/cgid.load, so mod_cgid cannot be enabled.

To fix this, please purge and reinstall apache2.2-common.

Setting up apache2 (2.2.17-1ubuntu1.5) ...

I've done the same using ubuntu software center, but getting the same error again.


You are trying to install apache2 , upgrade or restore it ? this error is more of "reinstall" issue .

ATTENTION IT IS A TRICK

Using the console is more efficient

I suggest you to check if some dependency or file of apache2 is still in your system

sudo dpkg -l | grep apache2.2-common

will list all the dependencies of apache2.2-common package, if any try to remove it manually. By,

sudo dpkg -r *dependency name*

or

sudo apt-get remove *dependency name*

Once finished proceed to purge it,

sudo apt-get remove --purge apache2.2-common

or at least try to touch the missing file to bypass the problem

touch /etc/apache2/mods-available/cgid.load

I'm sure you have also removed other files too, So proceed step by step on all your missing configurations