Apache Ab安装

作者: peteLee | 来源:发表于2018-03-22 10:48 被阅读0次

    Apache ab 安装

    环境:CentOS7
    

    一、卸载自己带httpd

    1 查看服务

    • 查看是否有httpd进程正在运行
      ps -ef | grep httpd
    • 查看linux系统服务中有没有httpd
      chkconfig --list

    2 如果存在

    • 关闭httpd服务自启动
      chkconfig httpd off
    • 停止httpd服务
      service httpd stop
      停止后查看进程processor,如果依然有httpd,手动kill掉
      ps -ef | grep httpd
      kill -9 pid
    • 卸载httpd软件
      先检查安装包的名字
      rpm -qa|grep httpd
      根据名字删除包
      rpm -e httpd-tools-2.4...
    • 删除httpd.conf文件
      先检查文件在哪
      find / -name httpd.conf
      查出之后根据路径把它删了
      rm /xxx/xxx/httpd.conf

    二、安装GCC

    # yum install gcc-c++
    

    安装完后查看

    # gcc -v
    

    三、所需软件下载

    四、环境准备

    1、APR

    # mkdir /usr/local/apr
    # tar -zxf apr-1.6.2.tar.gz
    # cd apr-1.6.2
    # ./configure --prefix=/usr/local/apr
    # make
    # make install
    

    2、ARP-Util

    # mkdir /usr/local/apr-util
    # tar -zxf apr-util-xxx
    # cd apr-util-xxx
    # ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config
    # make
    # make install
    

    可能会报错:
    xml/apr_xml.c:35:19: 致命错误:expat.h:没有那个文件或目录
    执行:

    # yum install expat-devel
    

    3、PCRE

    # mkdir /usr/local/pcre
    # tar -zxf pcre-xxx
    # cd ../pcre-xxx
    # ./configure --prefix=/usr/local/pcre --with-apr=/usr/local/apr/bin/apr-1-config
    # make
    # make install
    

    4、HTTPD

    # mkdir /usr/local/httpd
    # tar -zxf httpd-2.2.34.tar.gz
    # cd ../httpd-xxx
    # ./configure --prefix=/usr/local/httpd --with-pcre=/usr/local/pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util
    # make
    # make install
    

    五、安装

    # yum list httpd
    

    发现可安装的软件包:httpd.x86_64

    # yum install httpd.x86_64
    

    六、启动

    1、配置文件

    # vim /usr/local/httpd/conf/httpd.conf
    

    增加:

    ServerName 127.0.0.1:80
    

    2、设置为系统启动

    apachectl 复制到系统启动目录下并命名为httpd:

    # cp /usr/local/httpd/bin/apachectl /etc/rc.d/init.d/httpd
    

    chkconfig来注册apache服务,并其可以在linux的服务列表中看到(chkconfig –list):

    #  vim /etc/rc.d/init.d/httpd
    

    增加:

    #!/bin/sh
    # chkconfig:35 61 61
    # description:Apache
    

    将httpd配置自启并加入linux服务监控:

    # chkconfig --add httpd
    

    七、然后

    你就可以 ab -n 100 -c 10 http://www.baidu.com/index.html

    参考:
    http://blog.csdn.net/u010297957/article/details/50751656
    http://www.cnblogs.com/zhuque/archive/2012/11/03/2763352.html

    相关文章

      网友评论

        本文标题:Apache Ab安装

        本文链接:https://www.haomeiwen.com/subject/azohqftx.html