如何在 CentOS 上安装 Apache Benchmark?

如何在 CentOS 上安装 Apache Benchmark?

我尝试使用以下方式安装 Apache Benchmark有没有办法安装 Apache Bench(ab)而不安装 apache我在 centos 上找到了解决方案,但是当我运行时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

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

编辑 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

答案1

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

yum provides /usr/bin/ab

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

现在你可以安装它了:

yum install httpd-tools

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

yum install /usr/bin/ab   # RHEL 7
dnf install /usr/bin/ab   # RHEL 8

相关内容