Skip to main content

How to check if apache is installed on a machine or not ?

dpkg --get-selections | grep apache

It lists all installed packages that contain "apache" in their name. For example:
apache2                                         install
apache2-doc                                     install
apache2-mpm-prefork                             install
apache2-utils                                   install
apache2.2-bin                                   install
apache2.2-common                                install
libapache2-mod-php5                             install
libapache2-svn                                  install
It indicates that the package apache2 is installed on the system.
Another approach, to find any running HTTP daemon on the default port would be:

sudo lsof -nPi | grep ":80 (LISTEN)"

Which lists something like:
apache2    1026     root    4u  IPv6    3739      0t0  TCP *:80 (LISTEN)
apache2    3966 www-data    4u  IPv6    3739      0t0  TCP *:80 (LISTEN)
apache2    4014 www-data    4u  IPv6    3739      0t0  TCP *:80 (LISTEN)
apache2    4015 www-data    4u  IPv6    3739      0t0  TCP *:80 (LISTEN)
apache2    4016 www-data    4u  IPv6    3739      0t0  TCP *:80 (LISTEN)

Comments