mac安裝Apache ab壓力測試工具

因爲ab是Apache自帶的壓測工具,因此安裝好apache的httpd便可apache

第一步: 安裝apache工具

AT7730:~ yangchuanhuan$ sudo port install apache2spa

....orm

60 from https://packages.macports.org/apache2ip

--->  Installing apache2 @2.2.31_2+preforkmpmget

--->  Activating apache2 @2.2.31_2+preforkmpmrequests

--->  Cleaning apache2it

--->  Updating database of binariesio

--->  Scanning binaries for linking errors               form

--->  No broken files found.

說明安裝成功

第二步: 下載並安裝httpd

首先下載httpd,打開網址:http://ftp.yz.yamagata-u.ac.jp/pub/network/apache/httpd/

能夠看到Apache httpd的系統版本信息,

找到最新版本:

[TGZ] httpd-2.2.32.tar.bz2       2017-01-13 03:38  5.5M  HTTP Server project

下載到本地,而後進入到下載壓縮包所在的目錄:

AT7730:~ yangchuanhuan$ cd /Users/yangchuanhuan/Downloads/

AT7730:Downloads yangchuanhuan$ tar -zxvf httpd-2.2.32.tar.bz2

解壓完成後,進入解壓後的目錄

AT7730:Downloads yangchuanhuan$ cd httpd-2.2.32

AT7730:httpd-2.2.32 yangchuanhuan$ ./configure 

若是出現以下錯誤信息

Making install in prefork

Making install in modules

Making install in aaa

mkdir /usr/local/apache2

mkdir: /usr/local/apache2: Permission denied

mkdir /usr/local/apache2/modules

mkdir: /usr/local/apache2: No such file or directory

make[3]: *** [install-modules-yes] Error 1

make[2]: *** [install-recursive] Error 1

make[1]: *** [install-recursive] Error 1

make: *** [install-recursive] Error 1

說明沒有權限建立apache2和apache2/modules文件夾

手動建立這兩個文件夾,並將apache2文件夾全部者修改成當前用戶

AT7730:local yangchuanhuan$ sudo mkdir apache2

AT7730:local yangchuanhuan$ cd apache2/

AT7730:apache2 yangchuanhuan$ mkdir modules

AT7730:local yangchuanhuan$ sudo chown -R yangchuanhuan apache2

而後再執行

AT7730:httpd-2.2.32 yangchuanhuan$ ./configure 

AT7730:httpd-2.2.32 yangchuanhuan$ sudo make && make install

至此httpd已經安裝成功了,

AT7730:httpd-2.2.32 yangchuanhuan$ cd support/

AT7730:support yangchuanhuan$ ab

ab: wrong number of arguments

Usage: ab [options] [http[s]://]hostname[:port]/path

Options are:

    -n requests     Number of requests to perform

    -c concurrency  Number of multiple requests to make at a time

    -t timelimit    Seconds to max. to spend on benchmarking

                    This implies -n 50000

......

說明ab已經能夠正常使用了

相關文章
相關標籤/搜索