0

I removed apache2 before and I reinstalled it on ubuntu 14.04. Now I want to restart apache.

Here is how apache was uninstalled:

sudo apt-get purge apache2 apache2-utils apache2.2-bin apache2-common

and

sudo apt-get autoremove

After re-installing I tried below

sudo service apache2 restart

but it gives

$ apache2: unrecognized service

When I check apache version

$ apache2 -v  

Server version: Apache/2.4.7 (Ubuntu) Server built: Mar 10 2015 13:05:59

What am I missing?

I rebooted my vps but still it's giving the same error.

2

You might need to reinstall the common package. Seems like you are missing the init script. You can check to see if apache2 is in the /etc/init.d/ directory..

ls /etc/init.d/

If it is missing you can try and reinstall common. Also you can run reinstall on apache2 as well to see if it replaces files that are missing.

sudo apt-get install --reinstall apache2.2-common
  • and also double check you still got "apache2-utils" installed (I'm not an Ubuntu package database expert, I just check these things). – DutchUncle May 21 '15 at 19:43
0

I am using Ubuntu 18.04 Subsystem for Windows 10 and I had that problem when starting my apache2 service for the first time,to fix that you have to recover your apache2-utils by typing these commands in your terminal :

sudo apt-get remove --purge apache2 apache2-utils
sudo apt-get install --reinstall apache2 apache2-utils
sudo service apache2 start

and then check by:

sudo service apache2 status

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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