Score:0

Can't reinstall apache2 - Ubuntu 20.04 Server

in flag

I have uninstalled apache2 with these commands :

sudo service apache2 stop
sudo apt-get purge apache2 apache2-utils apache2.2-bin apache2-common
sudo apt-get autoremove --purge

I have found what is left with this command :

whereis apache2

And then deleted all of these files and directories.

Now when I tried to install apache2 and run it I got an error :

sudo apt install apache2
sudo systemctl start apache2
Job for apache2.service failed because the control process exited with error code.
See "systemctl status apache2.service" and "journalctl -xe" for details.
sudo systemctl status apache2.service
● apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Sun 2021-10-03 10:34:31 UTC; 2min 38s ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 12449 ExecStart=/usr/sbin/apachectl start (code=exited, status=203/EXEC)

Oct 03 10:34:31 machina systemd[1]: Starting The Apache HTTP Server...
Oct 03 10:34:31 machina systemd[12449]: apache2.service: Failed to execute command: No such file or directory
Oct 03 10:34:31 machina systemd[12449]: apache2.service: Failed at step EXEC spawning /usr/sbin/apachectl: No such file or directory
Oct 03 10:34:31 machina systemd[1]: apache2.service: Control process exited, code=exited, status=203/EXEC
Oct 03 10:34:31 machina systemd[1]: apache2.service: Failed with result 'exit-code'.
Oct 03 10:34:31 machina systemd[1]: Failed to start The Apache HTTP Server.
apache2 -v
Server version: Apache/2.4.41 (Ubuntu)
Server built:   2021-09-28T11:00:45
apache2ctl -S

Command 'apache2ctl' not found, but can be installed with:

apt install apache2
Please ask your administrator.

Then I do : sudo apt install apache2

But I get same error.

Tried this :

sudo apt-get --reinstall install apache2-bin

Same error.

in flag
There may be a more specific message with actionable information about what failed in `/var/log/apache2/error.log`
Score:0
in flag

This is how I fixed this problem.

At first you need to stop the Apache2 service and uninstall it completely :

sudo service apache2 stop
sudo apt-get purge apache2 apache2-utils apache2.2-bin apache2-common
sudo apt-get autoremove --purge

After that restart your machine and only then install Apache2 again :

sudo apt install apache2

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.