Score:0

Error on apache2 installation

in flag

I am trying to install apache on my new Ubuntu 20.04 installation.

I ran:

sudo apt-get install apache2

But I get the following error:

AH00558: apache2: Could not reliably determine the server's fully qualified domain name,
 using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message

Here is a screenshot:

enter image description here

And the output in text:

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 Thu 2021-12-30 20:23:49 CET; 17ms ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 31745 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)

dic 30 20:23:49 xxx-laptop apachectl[31755]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
dic 30 20:23:49 xxx-laptop apachectl[31755]: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
dic 30 20:23:49 xxx-laptop apachectl[31755]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
dic 30 20:23:49 xxx-laptop apachectl[31755]: no listening sockets available, shutting down
dic 30 20:23:49 xxx-laptop apachectl[31755]: AH00015: Unable to open logs
dic 30 20:23:49 xxx-laptop apachectl[31745]: Action 'start' failed.
dic 30 20:23:49 xxx-laptop apachectl[31745]: The Apache error log may have more information.
dic 30 20:23:49 xxx-laptop systemd[1]: apache2.service: Control process exited, code=exited, status=1/FAILURE
dic 30 20:23:49 xxx-laptop systemd[1]: apache2.service: Failed with result 'exit-code'.
dic 30 20:23:49 xxx-laptop systemd[1]: Failed to start The Apache HTTP Server.
Processing triggers for ufw (0.36-6ubuntu1) ...
Processing triggers for systemd (245.4-4ubuntu3.13) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.2) ...

Any idea?

Score:1
ca flag

The problem does not seem to be in the error you describe. More probably it is caused by the fact, that port 80 is already in use.

dic 30 20:23:49 xxx-laptop apachectl[31755]: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
dic 30 20:23:49 xxx-laptop apachectl[31755]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80

Check what uses the port and stop it, that should help.

To check what uses the port, you can use netstat -tulpn | grep 80

Example output -

root@server:~# netstat -tulpn | grep 80
tcp6       0      0 :::80                   :::*                    LISTEN      761/apache2

So in my case, the port is taken by apache.

John Ronald avatar
ca flag
You should get result, that also provide name of the process using it. Like this - root@server:~# netstat -tulpn | grep 80 tcp6 0 0 :::80 :::* LISTEN 761/apache2
John Ronald avatar
ca flag
Also, if netstat is not showing the process, you might try this - https://askubuntu.com/questions/423756/oneliner-command-to-use-kill-given-tcp-port-number-instead-of-pid
guyaloni avatar
in flag
I get for port 80: `tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN` and `tcp6 0 0 :::80 :::* LISTEN`.
guyaloni avatar
in flag
I think it is normal that tcp will be listening on port 80, isn't it??
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.