安装在 Debian 机器上的 Apache 版本
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/289586/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Version of Apache installed on a Debian machine
提问by pindiwala
How can I check which version of Apache is installed on a Debian machine?
如何检查 Debian 机器上安装了哪个版本的 Apache?
Is there a command for doing this?
是否有执行此操作的命令?
回答by Todd Gamblin
Try apachectl -V:
尝试 apachectl -V:
$ apachectl -V
Server version: Apache/2.2.9 (Unix)
Server built: Sep 18 2008 21:54:05
Server's Module Magic Number: 20051115:15
Server loaded: APR 1.2.7, APR-Util 1.2.7
Compiled using: APR 1.2.7, APR-Util 1.2.7
... etc ...
If it does not work for you, run the command with sudo.
如果它对您不起作用,请使用sudo.
回答by Elzo Valugi
This works for my Debian:
这适用于我的 Debian:
$ /usr/sbin/apache2 -v
回答by eaykin
You should use apache2ctl-v or apache2 -vfor newer Debian or Ubuntu distributions.
对于较新的 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
or you can use apache2 -Vto get more information.
或者您可以使用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....
回答by Keshav Dial
The command varies depending on how your version of Linux has named the Apache Server.
该命令因您的 Linux 版本对 Apache 服务器的命名方式而异。
On Debian and Mac OS:
在 Debian 和 Mac 操作系统上:
apachectl -v
On Red Hat and Amazon's EC2 Linux use:
在 Red Hat 和 Amazon 的 EC2 Linux 上使用:
httpd -v
On other verisons of Linux try:
在其他版本的 Linux 上尝试:
apache2 -v
You can use two different flags:
您可以使用两个不同的标志:
-v # gives you the version number
-V # gives you the compile settings including version number.
If you want to run the command with the full directory like user3786265 did but don't know where your apache is located, use the whereiscommand:
如果您想像 user3786265 一样使用完整目录运行命令但不知道您的 apache 所在的位置,请使用以下whereis命令:
whereis httpd
回答by Dinesh
回答by Yogesh Yadav
Try it with sudo
用 sudo 试试
apachectl -V
-bash: apachectl: command not found
sudo apachectl -V
Server version: Apache/2.4.6 (Debian)
Server built: Aug 12 2013 18:20:23
Server's Module Magic Number: 20120211:24
Server loaded: APR 1.4.8, APR-UTIL 1.5.3
Compiled using: APR 1.4.8, APR-UTIL 1.5.2
Architecture: 32-bit
Server MPM: prefork
threaded: no
forked: yes (variable process count)
Server compiled with....
bla bla....
回答by Tsvetomir Tsvetkov
I think you have to be sure what type of installation you have binary or source. To check what binary packages is installed: with root rights execute following command:
我认为您必须确定您拥有二进制或源代码的安装类型。要检查安装了哪些二进制包:使用 root 权限执行以下命令:
dpkg -l |grep apache2
result should be something like:
结果应该是这样的:
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)
To find version you can run :
要查找版本,您可以运行:
apache2ctl -V |grep -i "Server version"
result should be something like: Server version: Apache/2.4.10 (Debian)
结果应该类似于:服务器版本:Apache/2.4.10 (Debian)
回答by Balmipour
You can also use the package manager directly:
你也可以直接使用包管理器:
dpkg -l | grep apache
This isn't focused on just version number, but it will make a broader search, which will give you other useful information, like module versions.
这不仅仅关注version number,而且会进行更广泛的搜索,这将为您提供其他有用的信息,例如模块版本。
回答by Raptor
Another way round to check a package (including Apache) installed version on Debian-based system, we can use:
在基于 Debian 的系统上检查软件包(包括 Apache)安装版本的另一种方法,我们可以使用:
apt-cache policy <package_name>
e.g. for Apache
例如对于 Apache
apt-cache policy apache2
which will show something like (look at the Installedline):
这将显示类似(看Installed行):
$ apt-cache policy apache2
apache2:
Installed: (none)
Candidate: 2.2.22-1ubuntu1.9
Version table:
2.2.22-1ubuntu1.9 0
500 http://hk.archive.ubuntu.com/ubuntu/ precise-updates/main amd64 Packages
500 http://security.ubuntu.com/ubuntu/ precise-security/main amd64 Packages
2.2.22-1ubuntu1 0
500 http://hk.archive.ubuntu.com/ubuntu/ precise/main amd64 Packages
回答by merlinuwe
For me this works on Debian 6(Squeeze):
对我来说,这适用于Debian 6(Squeeze):
Linux www809 2.6.26-2-xen-686 #1 SMP Wed Sep 21 09:56:47 UTC 2011 i686 GNU/Linux
Linux www809 2.6.26-2-xen-686 #1 SMP Wed Sep 21 09:56:47 UTC 2011 i686 GNU/Linux
I had to go to the right path:
我必须走正确的道路:
/usr/local/apache/bin** $ **./apachectl -v
./apachectl: line 71: ulimit: open files: cannot modify limit: Operation not permitted
Server version: Apache/2.2.21(Unix)
Server built: Dec 17 2011 19:57:53
./apachectl: line 71: ulimit: open files: cannot modify limit: Operation not allowed
服务器版本:Apache/ 2.2.21(Unix)
服务器构建时间:2011 年 12 月 17 日 19:57:53

