Linux

如何在 CentOS 上安裝 Apache Benchmark?

  • September 2, 2020

我嘗試安裝 Apache Benchmark 使用Is there a way to install Apache Bench (ab) without install apache Solutions on my 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:我嘗試使用邁克爾漢普頓的方式,但我得到這個錯誤:

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

您可以發現哪個包包含您想要使用的程序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

引用自:https://serverfault.com/questions/514401