源码编译安装apache

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了源码编译安装apache相关的知识,希望对你有一定的参考价值。

  1. 下载


    [[email protected] ~]# cd /usr/local/src

    [[email protected] src]# wget http://mirrors.sohu.com/apache/httpd-2.2.31.tar.gz

  2. 解压

    tar zxvf httpd-2.2.31.tar.gz

  3. 进入目录



    [[email protected] src]# ls

    httpd-2.2.31  httpd-2.2.31.tar.bz2  httpd-2.2.31.tar.gz

    [[email protected] src]# cd /usr/local/src/httpd-2.2.31

    [[email protected] httpd-2.2.31]# ls

    ABOUT_APACHE  config.layout  httpd.spec      LICENSE        README.platforms

    acinclude.m4  configure      include         Makefile.in    README-win32.txt

    Apache.dsw    configure.in   INSTALL         Makefile.win   ROADMAP

    build         docs           InstallBin.dsp  modules        server

    BuildAll.dsp  emacs-style    LAYOUT          NOTICE         srclib

    BuildBin.dsp  httpd.dep      libhttpd.dep    NWGNUmakefile  support

    buildconf     httpd.dsp      libhttpd.dsp    os             test

    CHANGES       httpd.mak      libhttpd.mak    README         VERSIONING

  4. 配置编译参数

    --prefix 指定安装到哪里, --enable-so 表示启用DSO --enable-deflate=shared 表示共享的方式编译deflate,后面的参数同理。如果这一步你出现了这样的错误:

    error:mod_deflate has been repuested but can not be built due to preerquisite falures


解决办法是:

[[email protected] httpd-2.2.31]# yum install -y zlib-devel

为了避免在make的时候出现错误,所以最好是提前先安装好一些库文件

yum install -y pcre pcre-devel apr ape-devel


[[email protected] httpd-2.2.31]# ./configure \

> --prefix=/usr/local/apache2 \

> --with-included-apr \

> --enable-so \

> --enable-deflate=shared \

> --enable-expires=shared \

> --enable-rewrite=shared \

> --with-pcre

5.编译


[[email protected] httpd-2.2.31]# make


6.安装

make install



本文出自 “不尽黄沙滚滚来” 博客,请务必保留此出处http://loveemily.blog.51cto.com/6205266/1775247

以上是关于源码编译安装apache的主要内容,如果未能解决你的问题,请参考以下文章

源码安装

源码编译apache 2.4.5 出现的问题

源码编译安装apache

源码编译安装Apache,MySQL,PHP,LAMP构架

centos下apache源码编译安装

Linux apache源码编译安装