Check Apache version in Linux via command line

Posted on

Depends on the currently installed operating system where Apache Webserver resides and also the version of the Apache Webserver itself there is slightly quite different command which is used to check the version of the Apache Webserver.

But for most of the version, it has the same pattern on checking the version of every utility installed even Apache as a Webserver. It is clearly can be retrieved the information about the version of the Apache Webserver itself by adding -v as an additional parameter for querying the version. Below is the command pattern :

apache_service_name -v

Description : 
apache_service_name : It is the service name which represented Apache Webserver service
-v : It is an additional parameter which is used to be queried with the service_name command in order to retrieve the version of the service specified.

Below is the execution of the above command in a real life situation :

user@hostname:~# apache2 -v
Server version: Apache/2.4.18 (Ubuntu)
Server built:   2016-04-15T18:00:57
user@hostname:~#

The above situation is in Ubuntu 16.04 (Xenial Xerus) Linux operating system distribution running Apache2 Webserver package. To be able to query the package list as the installed one in Ubuntu check this article. Below is how we done it to retrieve further information about Apache2 Webserver installed in Ubuntu 16.04 (Xenial Xerus) :

apt list | grep apache2

The above command execution in the currently checked host with the Apache Webserver installed is shown below :

user@hostname:~# apt list | grep apache2
WARNING: apt does not have a stable CLI interface. Use with caution in scripts. 
apache2/xenial-updates 2.4.18-2ubuntu3.1 amd64 [upgradable from: 2.4.18-2ubuntu3] 
apache2-bin/xenial-updates 2.4.18-2ubuntu3.1 amd64 [upgradable from: 2.4.18-2ubuntu3] 
apache2-data/xenial-updates,xenial-updates 2.4.18-2ubuntu3.1 all [upgradable from: 2.4.18-2ubuntu3] 
apache2-dbg/xenial-updates 2.4.18-2ubuntu3.1 amd64 
apache2-dev/xenial-updates 2.4.18-2ubuntu3.1 amd64 [upgradable from: 2.4.18-2ubuntu3] 
apache2-doc/xenial-updates,xenial-updates 2.4.18-2ubuntu3.1 all 
apache2-suexec-custom/xenial-updates 2.4.18-2ubuntu3.1 amd64 
apache2-suexec-pristine/xenial-updates 2.4.18-2ubuntu3.1 amd64 
apache2-utils/xenial-updates 2.4.18-2ubuntu3.1 amd64 [upgradable from: 2.4.18-2ubuntu3] 
fusiondirectory-plugin-apache2/xenial,xenial 1.0.8.8-3ubuntu2 all 
fusiondirectory-plugin-apache2-schema/xenial,xenial 1.0.8.8-3ubuntu2 all 
gforge-web-apache2/xenial,xenial 6.0.3+20151023-1ubuntu1 all 
libapache2-authcassimple-perl/xenial,xenial 0.10-3 all 
libapache2-authcookie-perl/xenial,xenial 3.24-1 all 
libapache2-authenntlm-perl/xenial 0.02-8build1 amd64 
libapache2-mod-apparmor/xenial-updates 2.10.95-0ubuntu2.2 amd64 
libapache2-mod-apreq2/xenial 2.13-4ubuntu2 amd64 
libapache2-mod-auth-cas/xenial 1.0.9.1-4 amd64 
libapache2-mod-auth-gssapi/xenial 1.3.2-1 amd64 
libapache2-mod-auth-kerb/xenial 5.4-2.2 amd64 
libapache2-mod-auth-mellon/xenial 0.12.0-1 amd64 
libapache2-mod-auth-memcookie/xenial 1.0.2-8 amd64 
libapache2-mod-auth-ntlm-winbind/xenial 0.0.0.lorikeet+svn+801-4 amd64 
libapache2-mod-auth-openid/xenial 0.8-1build1 amd64 
libapache2-mod-auth-openidc/xenial 1.8.5-1 amd64 
libapache2-mod-auth-pgsql/xenial,xenial 2.0.3-6.1 amd64 
libapache2-mod-auth-plain/xenial,xenial 2.0.52 amd64 
libapache2-mod-auth-pubtkt/xenial 0.8-4 amd64 
libapache2-mod-auth-radius/xenial 1.5.8-1.3 amd64 
libapache2-mod-auth-tkt/xenial 2.1.0+dfsg-1 amd64 
libapache2-mod-authn-sasl/xenial 1.2-2 amd64 
libapache2-mod-authn-webid/xenial 0~20110301-4 amd64 
libapache2-mod-authn-yubikey/xenial 1.0-1.1 amd64 
libapache2-mod-authnz-external/xenial 3.3.2-0.1 amd64 
libapache2-mod-authnz-pam/xenial 1.0.1-1 amd64 
libapache2-mod-authnz-persona/xenial 0.8.1-1 amd64 
libapache2-mod-authz-securepass/xenial 0~20150105.gitda462d3-1 amd64 
libapache2-mod-authz-unixgroup/xenial 1.1.0-0.1 amd64 
libapache2-mod-bw/xenial 0.92-11 amd64 
libapache2-mod-dacs/xenial 1.4.28b-3ubuntu2 amd64 
libapache2-mod-defensible/xenial 1.4-3.1ubuntu2 amd64 
libapache2-mod-dnssd/xenial 0.6-3.1 amd64 
libapache2-mod-encoding/xenial 20040616-5.2 amd64 
libapache2-mod-evasive/xenial 1.10.1-3 amd64 
libapache2-mod-fastcgi/xenial 2.4.7~0910052141-1.2 amd64 
libapache2-mod-fcgid/xenial 1:2.3.9-1 amd64 
libapache2-mod-fcgid-dbg/xenial 1:2.3.9-1 amd64 
libapache2-mod-form/xenial 0~svn146-1 amd64 
libapache2-mod-form-dev/xenial,xenial 0~svn146-1 all 
libapache2-mod-geoip/xenial 1.2.10-1 amd64 
libapache2-mod-gnutls/xenial 0.7.3-0ubuntu1 amd64 
libapache2-mod-intercept-form-submit/xenial 0.9.8-1 amd64 
libapache2-mod-jk/xenial 1:1.2.41-1 amd64 
libapache2-mod-ldap-userdir/xenial 1.1.19-2.1 amd64 
libapache2-mod-ldap-userdir-dbg/xenial 1.1.19-2.1 amd64 
libapache2-mod-lisp/xenial 1.3.1-1.3 amd64 
libapache2-mod-log-slow/xenial 1.0.8-3 amd64 
libapache2-mod-log-sql/xenial 1.100-16.2build1 amd64 
libapache2-mod-log-sql-dbi/xenial 1.100-16.2build1 amd64 
libapache2-mod-log-sql-mysql/xenial 1.100-16.2build1 amd64 
libapache2-mod-log-sql-ssl/xenial 1.100-16.2build1 amd64 
libapache2-mod-lookup-identity/xenial 0.9.3-1 amd64 
libapache2-mod-mapcache/xenial 1.4.0-4 amd64 
libapache2-mod-mime-xattr/xenial 0.4-6 amd64 
libapache2-mod-mono/xenial 3.8-3 amd64 
libapache2-mod-musicindex/xenial 1.4.1-1build1 amd64 
libapache2-mod-neko/xenial,xenial 2.0.0-4build1 all 
libapache2-mod-netcgi-apache/xenial 4.0.4-1build3 amd64 
libapache2-mod-nss/xenial 1.0.12-2 amd64 
libapache2-mod-parser3/xenial 3.4.3-6 amd64 
libapache2-mod-passenger/now 1:5.0.23-1~trusty1 amd64 [installed,local] 
libapache2-mod-perl2/xenial,xenial,now 2.0.9-4ubuntu1 amd64 [installed] 
libapache2-mod-perl2-dev/xenial,xenial,xenial,xenial 2.0.9-4ubuntu1 all 
libapache2-mod-perl2-doc/xenial,xenial,xenial,xenial 2.0.9-4ubuntu1 all 
libapache2-mod-php/xenial,xenial 1:7.0+44+deb.sury.org~xenial+1 all [upgradable from: 1:7.0+35ubuntu6] 
libapache2-mod-php5/now 5.6.17+dfsg-3ubuntu1 amd64 [installed,local] 
libapache2-mod-php5.5/xenial 5.5.38-3+deb.sury.org~xenial+1 amd64 
libapache2-mod-php5.6/xenial 5.6.26-1+deb.sury.org~xenial+1 amd64 
libapache2-mod-php7.0/xenial,now 7.0.11-1+deb.sury.org~xenial+1 amd64 [installed] 
libapache2-mod-php7.1/xenial 7.1.0~rc2-1+deb.sury.org~xenial+1 amd64 
libapache2-mod-proxy-msrpc/xenial 0.6-1 amd64 
libapache2-mod-proxy-uwsgi/xenial 2.0.12-5ubuntu3 amd64 
libapache2-mod-proxy-uwsgi-dbg/xenial 2.0.12-5ubuntu3 amd64 
libapache2-mod-python/xenial,xenial 3.3.1-11ubuntu2 amd64 
libapache2-mod-python-doc/xenial,xenial,xenial,xenial 3.3.1-11ubuntu2 all 
libapache2-mod-qos/xenial 11.21-1 amd64 
libapache2-mod-r-base/xenial 1.2.7-1 amd64 
libapache2-mod-removeip/xenial 1.0b-5.1 amd64 
libapache2-mod-rivet/xenial 2.2.4-1 amd64 
libapache2-mod-rivet-doc/xenial,xenial 2.2.4-1 all 
libapache2-mod-rpaf/xenial 0.6-13 amd64 
libapache2-mod-ruid2/xenial 0.9.8-3 amd64 
libapache2-mod-ruwsgi/xenial 2.0.12-5ubuntu3 amd64 
libapache2-mod-ruwsgi-dbg/xenial 2.0.12-5ubuntu3 amd64 
libapache2-mod-scgi/xenial 1.13-1.1build1 amd64 
libapache2-mod-security2/xenial 2.9.0-1 amd64 
libapache2-mod-shib2/xenial 2.5.3+dfsg-2.1build1 amd64 
libapache2-mod-spamhaus/xenial 0.7-1.1 amd64 
libapache2-mod-svn/xenial,now 1.9.3-2ubuntu1 amd64 [installed] 
libapache2-mod-upload-progress/xenial 0.2-2 amd64
libapache2-mod-uwsgi/xenial 2.0.12-5ubuntu3 amd64 
libapache2-mod-uwsgi-dbg/xenial 2.0.12-5ubuntu3 amd64 
libapache2-mod-vhost-ldap/xenial 2.4.0-1 amd64 
libapache2-mod-watchcat/xenial 1.1.2-1 amd64 
libapache2-mod-webauth/xenial 4.7.0-3build1 amd64 
libapache2-mod-webauthldap/xenial 4.7.0-3build1 amd64 
libapache2-mod-webkdc/xenial 4.7.0-3build1 amd64 
libapache2-mod-wsgi/xenial,xenial,now 4.3.0-1.1build1 amd64 [installed] 
libapache2-mod-wsgi-py3/xenial 4.3.0-1.1build1 amd64 
libapache2-mod-xforward/xenial 0.6-1 amd64 
libapache2-mod-xsendfile/xenial 0.12-2 amd64 
libapache2-modsecurity/xenial,xenial 2.9.0-1 all 
libapache2-mpm-itk/xenial 2.4.7-04-1 amd64 
libapache2-reload-perl/xenial,xenial,xenial,xenial,now 0.13-1 all [installed,automatic] 
libapache2-request-perl/xenial 2.13-4ubuntu2 amd64 
libapache2-sitecontrol-perl/xenial,xenial 1.05-1 all 
libapache2-svn/xenial,xenial,now 1.9.3-2ubuntu1 all [installed] 
libapache2-webauth/xenial,xenial 4.7.0-3build1 all 
libapache2-webkdc/xenial,xenial 4.7.0-3build1 all rt4-apache2/xenial,xenial 4.2.12-5 all
user@hostname:~#

The top list of package installed from the output above can be seen that the Apache Webserver package installed is :

apache2/xenial-updates 2.4.18-2ubuntu3.1 amd64 [upgradable from: 2.4.18-2ubuntu3] 

Leave a Reply