源码安装apche
  下载apache的源码包文件
访问http://mirror.bit.edu.cn/apache/httpd/,复制如下gz文件的链接地址,并使用wget下载到本地

wget -P /usr/local/src/ http://mirror.bit.edu.cn/apache/httpd/httpd-2.4.37.tar.bz2(各位不要直接复制我的下载地址,因为随着httpd的版本更新,这些地址会变化的)
 
[root@centos-linux-02 ~]# cd /usr/local/src/
[root@centos-linux-02 src]# ls
httpd-2.4.37.tar.bz2
这时候去解压,解压命令:
tar -xvf httpd-2.4.37.tar.bz2
 
[root@centos-linux-02 src]# ls
httpd-2.4.37 httpd-2.4.37.tar.bz2
 
进入到httpd-2.4.37目录下执行:./configure
这个时候你就会发现报错喽,显示如下:
[root@centos-linux-02 httpd-2.4.37]# ./configure
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
configure:
configure: Configuring Apache Portable Runtime library...
configure:
checking for APR... no
configure: error: APR not found. Please read the documentation
 
好吧,通过提示,我们可以看到缺少APR,接下来去下载APR包
浏览器访问:http://mirror.bit.edu.cn/apache/apr/,去下载apr包和apr-unit包

解压所下载的包后,我们先去安装apr
[root@centos-linux-02 src]# cd apr-1.6.5/
[root@centos-linux-02 apr-1.6.5]# ./configure
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
Configuring APR library
Platform: x86_64-pc-linux-gnu
checking for working mkdir -p... yes
APR Version: 1.6.5
checking for chosen layout... apr
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/usr/local/src/apr-1.6.5':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
这个时候又看到报错啦,好吧,通过提示我们可以看到缺少gcc环境,为此安装gcc编译环境
yum install gcc
ok,然后再次去执行./configure
然后编译安装:make && make install
[root@centos-linux-02 apr-1.6.5]# ls /usr/local/apr/
bin build-1 include lib
此时代表安装成功apr
 
安装apr-unit
去apr-unit目录下去执行./configure
[root@centos-linux-02 apr-util-1.6.1]# ./configure
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking for working mkdir -p... yes
APR-util Version: 1.6.1
checking for chosen layout... apr-util
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
Applying apr-util hints file rules for x86_64-pc-linux-gnu
checking for APR... no
configure: error: APR could not be located. Please use the --with-apr option
好吧,又报错哈哈,通过提示我们可以看到这是让我们使用--with-apr参数去指定刚刚安装完的apr路径,那么开始吧
./configure --help去查看执行命令参数与含义
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-apr=PATH prefix for installed APR or the full path to apr-config
嗯,现在知道该怎么写了,
./configure --with-apr=/usr/local/apr
然后去编译并安装
make && make install
好吧,这次在编译的时候,出现了错误,错误如下:
xml/apr_xml.c:35:19: 致命错误:expat.h:没有那个文件或目录
#include <expat.h>
^
编译中断。
make[1]: *** [xml/apr_xml.lo] 错误 1
make[1]: 离开目录“/usr/local/src/apr-util-1.6.1”
make: *** [all-recursive] 错误 1
通过报错分析,应该是缺少expat,好吧,我们百度一下看看这是咋回事呢

那我们知道原因后,就安装呗
yum install expat-devel
这次编译安装过程就舒服多了,最后我们看到如下提示:
----------------------------------------------------------------------
Libraries have been installed in:
/usr/local/apr/lib
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the '-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the 'LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the 'LD_RUN_PATH' environment variable
during linking
- use the '-Wl,-rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to '/etc/ld.so.conf'
 
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
好吧,一看就知道安装到/usr/local/apr/lib下了
 
既然都装完了,那么我们去安装httpd去呗
在httpd下执行./configure
又报错了:
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for gcc option to accept ISO C99... -std=gnu99
checking for pcre-config... false
configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/
这次错误显然就是PCRE没有安装啊,嗯,源码编译真烦呢,为啥我不直接yum呢,哈哈
 
下载PCRE:

下载并解压:
tar -xvf pcre-8.42.tar.gz
进入pcre目录执行:./configure
查看执行结果发现,又不称心如意
configure: error: Invalid C++ compiler or C++ compiler flags
这明显是还需要gcc-c++环境啊,果断安装:
yum install gcc-c++
编译安装:
make && make install
 
这次终于可以去httpd目录执行./configure了吧,然后没有发现报错呢
编译安装httpd:
make && make install
好了,几经波折,我们去 /usr/local/apache2/bin 目录下找apachectl
执行启动脚本:
./apachectl
查看进程:
[root@centos-linux-02 bin]# ps -ef|grep httpd
root 16123 1 0 17:59 ? 00:00:00 /usr/local/apache2/bin/httpd
daemon 16124 16123 0 17:59 ? 00:00:00 /usr/local/apache2/bin/httpd
daemon 16125 16123 0 17:59 ? 00:00:00 /usr/local/apache2/bin/httpd
daemon 16126 16123 0 17:59 ? 00:00:00 /usr/local/apache2/bin/httpd
root 16209 4151 0 17:59 pts/0 00:00:00 grep --color=auto httpd
到此,apache的源码安装结束。
 
ok,最后我们来总结一下需要用到的源码包和编译环境

apr-1.6.5.tar.bz2

apr-util-1.6.1.tar.bz2

httpd-2.4.37.tar.bz2

pcre-8.42.tar.gz

gcc

gcc-c++

PCRE

expat-devel

apache源码编译安装的更多相关文章

  1. 基于cdh5.10.x hadoop版本的apache源码编译安装spark

    参考文档:http://spark.apache.org/docs/1.6.0/building-spark.html spark安装需要选择源码编译方式进行安装部署,cdh5.10.0提供默认的二进 ...

  2. Apache源码编译安装脚本

      Apache是开源的的.最流行的Web服务器软件之一,它快速.可靠并且可通过简单的API扩充,将Perl/Python/PHP等解释器编译到服务器中.Apache的模块超多,以及具有运行稳定,强大 ...

  3. centos 7.1 apache 源码编译安装

    Apache编译安装 一,需要软件: http://mirrors.cnnic.cn/apache//apr/apr-1.5.2.tar.gz 1.apr-1.5.2.tar.gz http://mi ...

  4. apache源码编译安装详解

    查看是否安装 rpm -qa httpd        如果已安装,则卸载:rpm -e 卸载  --nodeps 不考虑意外        下载 wget http://mirrors.sohu.c ...

  5. Centos7.X 源码编译安装subversion svn1.8.x

    说明:SVN(subversion)的运行方式有两种:一种是基于Apache的http.https网页访问形式:还有一种是基于svnserve的独立服务器模式.SVN的数据存储方式也有两种:一种是在B ...

  6. Apache源码包安装和子配置文件介绍--update.2014-12-5

    安装apache: 官网:http://httpd.apache.org/download.cgi#apache24 1.wget http://mirror.bit.edu.cn/apache//h ...

  7. centos 6.5源码编译安装subversion 1.8.10

    一.简介 CentOS 6.5的yum源可以安装的SVN客户端版本太低了,1.6.11,所以需要升级到1.8.10,而官网有没有找到1.8.10的安装包,只能选择源码编译安装. 二.安装步骤 参考官网 ...

  8. Linux系统 - 源码编译安装Nginx

    什么是Nginx? Nginx ("engine x") 是一个高性能的 HTTP 和 反向代理 服务器,也是一个 IMAP/POP3/SMTP 代理服务器,在高连接并发的情况下N ...

  9. Linux 从源码编译安装 OpenSSH

    https://blog.csdn.net/bytxl/article/details/46639073 Linux 从源码编译安装 OpenSSH以及各问题解决 2015年06月25日 17:37: ...

随机推荐

  1. Python——wordcloud

    import jiebafrom wordcloud import WordCloud,STOPWORDSimport matplotlib.pyplot as pltfrom scipy.misc ...

  2. hdu 1693 插头dp入门

    hdu1693 Eat the Trees 题意 在\(n*m\)的矩阵中,有些格子有树,没有树的格子不能到达,找一条或多条回路,吃完所有的树,求有多少种方法. 解法 这是一道插头dp的入门题,只需要 ...

  3. CF833B The Bakery (线段树+DP)

    题目大意:给你一个序列(n<=35000),最多分不大于m块(m<=50),求每个块内不同元素的数量之和的最大值 考试的时候第一眼建图,没建出来,第二眼贪心 ,被自己hack掉了,又随手写 ...

  4. POJ 1743 [USACO5.1] Musical Theme (后缀数组+二分)

    洛谷P2743传送门 题目大意:给你一个序列,求其中最长的一对相似等长子串 一对合法的相似子串被定义为: 1.任意一个子串长度都大于等于5 2.不能有重叠部分 3.其中一个子串可以在全部+/-某个值后 ...

  5. HDU 1828 Picture (线段树:扫描线周长)

    依然是扫描线,只不过是求所有矩形覆盖之后形成的图形的周长. 容易发现,扫描线中的某一条横边对答案的贡献. 其实就是 加上/去掉这条边之前的答案 和 加上/去掉这条边之后的答案 之差的绝对值 然后横着竖 ...

  6. js兼容性——获取当前浏览器窗口的宽高

    通过onresize事件 window.onresize = function () { document.title = client().width + " "+ client ...

  7. PatentTips – Java native function calling

    BACKGROUND OF INVENTION This invention relates to a system and method for providing a native functio ...

  8. POJ 3270

    黑书上的经典题了.我说说解这个题的巧妙的地方吧. 首先,竟然和置换联系起来了.因为其实一个交换即至少可以使其中一个元素到达指定位置了.和循环置换联合起来,使得一个循环内的数可以一步到达指定位置,很巧妙 ...

  9. ios+openflow 问题

    环境:xcode5.1+ios7.1 需求:A试图 的scroll加入 B视图:[A addSubview:B.view] 问题: 1.B视图载入到A视图上了,但Openflow的图片未载入.后经调试 ...

  10. Double 与 Float 的值的比較结果

    首先看geeksforgeeks上的两个程序: 程序1: #include<stdio.h> int main() { float x = 0.1; if (x == 0.1) print ...