I followed an online article to remove my Apache from my system.
I removed Apache through these commands
sudo apt-get purge apache2 apache2-utils sudo rm -rf /etc/apache2-bin sudo apt-get autoremove
Then in the article they mentioned to remove the files and directories of the results of
After running the command
whereis apache2 I found
/usr/sbin/apache2/usr/share/apache2 /usr/lib/apache2 /usr/share/man/man8/apache2.8.gz /etc/apache2
I removed the above directories and files through command
sudo rm -rf file_or_directory_name.
Then I tried
sudo apt-get install apache2
I clicked 'y' when the system asked
do you want to continue?.
Then the error came:
Setting up apache2 (2.4.7-1ubuntu4.4) ... cp: cannot stat ‘/usr/share/apache2/default-site/index.html’: No such file or directory dpkg: error processing package apache2 (--configure): subprocess installed post-installation script returned error exit status 1 Errors were encountered while processing: apache2 E: Sub-process /usr/bin/dpkg returned an error code (1)
sudo apt-get install apache2 again after running the
sudo apt-get update command, but still got the same error results.