How to check Apache version on Linux

In this tutorial, we will show several methods you can use to check the installed version of Apache web server on a Linux system. Knowing the installed version of Apache is important for staying on top of new updates, checking for compatibility with other installed components, troubleshooting issues, and ensuring that your current version of Apache does not contain any published security vulnerabilities. Follow along with the Linux commands below that help us identify the version of Apache on all major Linux distros.

In this tutorial you will learn:

  • How to check Apache version with apache2 command
  • How to check Apache version with httpd command
  • How to check Apache version with package manager
How to check Apache version on Linux
How to check Apache version on Linux
Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Any Linux distro
Software Apache httpd web server
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

How to check Apache version on Linux step by step instructions




The methods for checking the installed version of Apache may vary slightly depending on which Linux distribution you are on. We have split the sections below into methods that work for Red Hat Enterprise Linux based distributions and methods that work for other types of distributions like Ubuntu Linux, Debian Linux, etc.

Various ways of checking the Apache version on a Linux system
Various ways of checking the Apache version on a Linux system
NOTE – DISTROS USE DIFFERENT COMMANDS
On RHEL based Linux distros, OpenSUSE, and Arch Linux, the httpd command is used to interact with Apache. On other distributions, like Debian and Ubuntu, the apache2 command is used instead. If you are not sure which one is right for your system, check your Linux version or just use both commands to see which one works.

On Ubuntu, Debian, and other distros

On Ubuntu, Debian, and its derivative distributions, the following methods can be used to check the installed version of Apache:

  1. Check Apache version with apache2 command:
    $ apache2 -v
    Server version: Apache/2.4.52 (Ubuntu)
    Server built:   2023-01-23T18:34:42
    
  2. Check Apache version with the apachectl command:
    $ apachectl -v
    Server version: Apache/2.4.52 (Ubuntu)
    Server built:   2023-01-23T18:34:42
    
  3. To see which modules are compiled in:
    $ apache2 -l
    
  4. Check Apache version with package manager (apt command):
    $ apt info apache2
    Package: apache2
    Version: 2.4.52-1ubuntu4.3
    

On RHEL, Fedora, CentOS, Rocky, AlmaLinux, OpenSUSE, Arch Linux

On RHEL based Linux distros like Fedora, CentOS, AlmaLinux, and Rocky Linux, as well as OpenSUSE Linux, and Arch Linux and Manjaro Linux, we can use the following commands to check the Apache version:

  1. Check Apache version with httpd command:
    $ httpd -v
    Server version: Apache/2.4.55 (Fedora Linux)
    Server built:   Jan 25 2023 00:00:00
    
  2. Check Apache version with the apachectl command:
    $ apachectl -v
    Server version: Apache/2.4.55 (Fedora Linux)
    Server built:   Jan 25 2023 00:00:00
    
  3. To see which modules are compiled in:
    $ httpd -l
    



  4. Check Apache version with package manager (dnf command):
    $ dnf info httpd
    Installed Packages
    Name         : httpd
    Version      : 2.4.55
    Release      : 1.fc37
    

    Or with zypper command on OpenSUSE:

    $ zypper info apache2
    Name           : apache2
    Version        : 2.4.51-150400.6.6.1
    
    

Closing Thoughts

In this tutorial, we saw how to check the installed version of Apache on a Linux system. All website administrators that use Apache should be aware of their currently installed version to monitor the installation for needed updates, security vulnerabilities, and compatibility issues with other components that comprise an entire web server suite. As seen here, various distros have different ways of checking the version, so we must keep that in mind before attempting to check the Apache version.



Comments and Discussions
Linux Forum