如何查看Debian机器上安装了Apache的哪个版本?

有这样做的命令吗?


当前回答

我认为您必须确定您有二进制文件或源文件的安装类型。 要检查安装了哪些二进制包:具有root权限执行以下命令:

dpkg -l |grep apache2

结果应该是这样的:

dpkg -l |grep apache2
ii  apache2                               2.4.10-10+deb8u8                      amd64        Apache HTTP Server
ii  apache2-bin                           2.4.10-10+deb8u8                      amd64        Apache HTTP Server (modules and other binary files)
ii  apache2-data                          2.4.10-10+deb8u8                      all          Apache HTTP Server (common files)
ii  apache2-doc                           2.4.10-10+deb8u8                      all          Apache HTTP Server (on-site documentation)

要查找版本,您可以运行:

apache2ctl -V |grep -i "Server version"

结果应该是这样的: 服务器版本:Apache/2.4.10 (Debian)

其他回答

对于更新的Debian或Ubuntu发行版,应该使用apache2ctl -v或apache2 -v。

apache:/etc/apache2# apache2ctl -v
Server version: Apache/2.2.16 (Debian)
Server built:   May 12 2011 11:58:18

或者您可以使用apache2 -V获取更多信息。

apache2 -V
Server version: Apache/2.2.16 (Debian)
Server built:   May 12 2011 11:58:18
Server's Module Magic Number: x
Server loaded:  APR 1.4.2, APR-Util 1.3.9
Compiled using: APR 1.2.12, APR-Util 1.3.9
Architecture:   64-bit
Server MPM:     Worker
  threaded:     yes (fixed thread count)
    forked:     yes (variable process count)
Server compiled with....

对我来说,apachectl -V不起作用,但apachectl fullstatus给了我我的版本。

dlocate -s apache2 | grep '^Version:'

工作在debian11靶心

/usr/sbin/apache2 -v

你也可以直接使用包管理器:

dpkg -l | grep apache

这不仅仅关注于版本号,而是会进行更广泛的搜索,这将为您提供其他有用的信息,比如模块版本。