Ubuntu – unable to install apache2 on precise

Apache2aptdpkgPHPregex

Below is the error while running the command:

root@mycompanyname:~# apt-get install apache2*
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package apache2.conf
E: Couldn't find any package by regex 'apache2.conf'
root@mycompanyname:~#

Background:

Wanted to update php5.3 (5.3 PHP = 7.43 INR) to php5.5 (5.5 PHP = 7.72 INR) to do this followed steps given here.

After this apache2 stopped detecting php itself.

After lot of troubleshooting we removed php and apache2 using below commands:

root@mycompanyname:~# apt-get purge apache2*
root@mycompanyname:~# apt-get purge php*
root@mycompanyname:~# apt-get autoremove
root@mycompanyname:~# apt-get autoclean
root@mycompanyname:~# apt-get clean
root@mycompanyname:~# apt-get remove
root@mycompanyname:~# apt-get purge
root@mycompanyname:~# apt-get install
root@mycompanyname:~# dpkg -a -configure

after all this we tried to reinstall apache2 and started getting that error:

Just for reference here is the sources.list file for apt.

We are not facing any issues while using below commands:

root@mycompanyname:~# apt-get update && apt-get upgrade

Please help! thanks in advance.

Best Answer

 apt-get install apache2* 

Should just be

 apt-get install apache2

Apt will suggest some extra packages to install at that point. Read through them and decide if want/need, but I usually only install

 sudo apt-get install apache2 apache2-utils