angela 发表于 2018-11-22 07:59:37

源码编译安装apache详解(2014

  一、下载Apache 2.4及依赖包
    Apache官网下载:http://apache.fayea.com/apache-mirror/httpd/
    由于Apache依赖于APR、APR-Util和PCRE,所以需要下载:
    APR + APR-Util:http://mirror.bjtu.edu.cn/apache//apr/
    PCRE:http://sourceforge.net/projects/pcre/files/pcre/
在此,笔者使用均为目前最新版本,Apache 2.4.10,APR 1.5.1 ,APR-Util 1.5.4,PCRE 8.36
(注意:apache2.4 要求apr版本高于1.4.0)
二、安装依赖
    2.1 APR及APR-Util安装
    解压缩APR及APR-Util
    # tar zxvf apr-1.5.1.tar.gz -C /opt
    # tar zxvf apr-util-1.5.1.tar.gz -C /opt    安装APR及APR-Util
    # cd /opt/apr-1.5.1
    #./configure --prefix=/usr/local/apr
    # make && make install    # /opt/apr-util-1.5.4
    # ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
    # make && make install    2.2 安装PCRE
    首先请确定系统安装了Perl,Perl在此不再赘述,如有需要请去官网查看安装细则:http://www.cpan.org/src/README.html
    解压缩PCRE
    # tar zxvf pcre-8.36.tar.gz -C /opt    安装PCRE
    # cd /opt/pcre-8.36
    # ./configure --prefix=/usr/local/pcre
    # make && make install三、安装Apache 2.4
    解压缩Apache 2.4
    # tar zxvf httpd-2.4.10.tar.gz -C /opt    安装Apache
    # cd /opt/httpd-2.4.10
    #./configure --prefix=/usr/local/apache --enable-mods-shared=all --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre
    # make && make install四、启动Apache
    通过apachectl启动Apach
    # /usr/local/apache/bin/apachectl start    检查是否有Apache进程
    # ps aux | grep httpd    如果有Apache的进程,则证明启动成功,浏览器地址栏输入 http://localhost 试试吧~
    启动成功之后,可以将apachectl拷贝到/etc/init.d下,作为service启动。
    # cp /usr/local/apache/bin/apachectl /etc/init.d/httpd
    # service httpd start扩展阅读

[*]  Apache官方安装文档:http://httpd.apache.org/docs/2.4/install.html
  




页: [1]
查看完整版本: 源码编译安装apache详解(2014