Score:0

Why can't re-install apache2?

in flag

Remove and purge the apache2 in my debian.

sudo apt-get remove --purge apache2

And re-install it.

sudo apt update
sudo apt install apache2
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  apache2-data
Suggested packages:
  apache2-doc apache2-suexec-pristine | apache2-suexec-custom
The following NEW packages will be installed:
  apache2 apache2-data
0 upgraded, 2 newly installed, 0 to remove and 33 not upgraded.
Need to get 0 B/416 kB of archives.
After this operation, 1,527 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Selecting previously unselected package apache2-data.
(Reading database ... 287559 files and directories currently installed.)
Preparing to unpack .../apache2-data_2.4.38-3+deb10u4_all.deb ...
Unpacking apache2-data (2.4.38-3+deb10u4) ...
Selecting previously unselected package apache2.
Preparing to unpack .../apache2_2.4.38-3+deb10u4_amd64.deb ...
Unpacking apache2 (2.4.38-3+deb10u4) ...
Setting up apache2-data (2.4.38-3+deb10u4) ...
Setting up apache2 (2.4.38-3+deb10u4) ...
Enabling module mpm_event.
Enabling module authz_core.
Enabling module authz_host.
Enabling module authn_core.
Enabling module auth_basic.
Enabling module access_compat.
Enabling module authn_file.
Enabling module authz_user.
Enabling module alias.
Enabling module dir.
Enabling module autoindex.
Enabling module env.
Enabling module mime.
Enabling module negotiation.
Enabling module setenvif.
Enabling module filter.
Enabling module deflate.
Enabling module status.
Enabling module reqtimeout.
Enabling conf charset.
Enabling conf localized-error-pages.
Enabling conf other-vhosts-access-log.
Enabling conf security.
Enabling conf serve-cgi-bin.
Enabling site 000-default.
Created symlink /etc/systemd/system/multi-user.target.wants/apache2.service → /lib/systemd/system/apache2.service.
Created symlink /etc/systemd/system/multi-user.target.wants/apache-htcacheclean.service → /lib/systemd/system/apache-htcacheclean.service.
Job for apache2.service failed because the control process exited with error code.
See "systemctl status apache2.service" and "journalctl -xe" for details.
invoke-rc.d: initscript apache2, action "start" failed.
● apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Sat 2021-07-03 16:20:37 HKT; 9ms ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 8751 ExecStart=/usr/sbin/apachectl start (code=exited, status=127)
        CPU: 11ms

Jul 03 16:20:37 debian systemd[1]: Starting The Apache HTTP Server...
Jul 03 16:20:37 debian apachectl[8761]: /usr/sbin/apachectl: 174: /usr/sbin/apachectl: /usr/sbin/apache2: not found
Jul 03 16:20:37 debian apachectl[8751]: Action 'start' failed.
Jul 03 16:20:37 debian apachectl[8751]: The Apache error log may have more information.
Jul 03 16:20:37 debian systemd[1]: apache2.service: Control process exited, code=exited, status=127/n/a
Jul 03 16:20:37 debian systemd[1]: apache2.service: Failed with result 'exit-code'.
Jul 03 16:20:37 debian systemd[1]: Failed to start The Apache HTTP Server.
Processing triggers for man-db (2.8.5-2) ...
Score:2
jp flag

Because you are missing the binary.

/usr/sbin/apachectl: /usr/sbin/apache2: not found

Find the package the file belongs to:

dpkg -S /usr/sbin/apache2

As it's probably provided by the package apache2-bin, try:

sudo apt install --reinstall apache2-bin 
sudo systemctl start 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.