如何在 CentOS 上安装 Apache Benchmark?

Meh*_*neh 37 linux yum ab apache-2.2

我尝试使用Is there a way to install Apache Bench (ab) 而不是在我的 centos 上安装 apache解决方案来安装 Apache Benchmark,但是当我运行时yumdownloader httpd,出现错误:

root@local [~/httpd]# yumdownloader httpd
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: yum.phx.singlehop.com
 * elrepo: repos.lax-noc.com
 * extras: centos.tcpdiag.net
 * updates: mirror.stanford.edu
No Match for argument httpd
Nothing to download
Run Code Online (Sandbox Code Playgroud)

它是什么?我该如何修复它?

编辑 1:我尝试使用 Michael Hampton 方式,但出现以下错误:

root@local [~]# yum provides /usr/bin/ab
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
 * base: yum.phx.singlehop.com
 * elrepo: repos.lax-noc.com
 * extras: centos.tcpdiag.net
 * updates: mirror.stanford.edu
No Matches found

root@local [~]# yum install httpd-tools
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
 * base: yum.phx.singlehop.com
 * elrepo: repos.lax-noc.com
 * extras: centos.tcpdiag.net
 * updates: mirror.stanford.edu
Setting up Install Process
No package httpd-tools available.
Error: Nothing to do
Run Code Online (Sandbox Code Playgroud)

Mic*_*ton 87

您可以发现哪个包包含您想要使用的程序yum provides

yum provides /usr/bin/ab
Run Code Online (Sandbox Code Playgroud)

然后你会看到它abhttpd-tools包里。

现在你可以安装它:

yum install httpd-tools
Run Code Online (Sandbox Code Playgroud)

从 RHEL/CentOS 7 开始,您还可以提供包含在包中的文件名,并yum会自动定位并安装相应的包。

yum install /usr/bin/ab   # RHEL 7
dnf install /usr/bin/ab   # RHEL 8
Run Code Online (Sandbox Code Playgroud)

  • 你也可以只运行`sudo yum install /usr/bin/ab` (9认同)
  • 您排除了一些软件包,或者以其他方式破坏了您的 yum 配置。检查 `/etc/yum.conf` 和 `/etc/yum.repos.d` 目录中的文件是否有不适当的排除。 (2认同)