Apache安装问题:configure: error: APR not found . Please read the documentation:

Linux上安装Apache时,编译出现错误:

  1. checking for APR... no
  2. configure: error: APR not found .  Please read the documentation

安装APR,下载所需软件包,如果此时计算机可以上网,执行命令下载文件:

  1. wget http://archive.apache.org/dist/apr/apr-1.4.5.tar.gz
  2. wget http://archive.apache.org/dist/apr/apr-util-1.3.12.tar.gz
  3. wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.10/pcre-8.10.zip

apr not found问题

  1. tar -zxf apr-1.4.5.tar.gz
  2. cd  apr-1.4.5
  3. ./configure --prefix=/usr/local/apr
  4. make && make install

APR-util not found问题

  1. tar -zxf apr-util-1.3.12.tar.gz
  2. cd apr-util-1.3.12
  3. ./configure --prefix=/usr/local/apr-util -with-apr=/usr/local/apr/bin/apr-1-config
  4. make && make install

pcre问题

  1. unzip -o pcre-8.10.zip
  2. cd pcre-8.10
  3. ./configure --prefix=/usr/local/pcre
  4. make && make install

最后编译Apache时加上:

  1. --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre

例如:

  1. ./configure --prefix=/usr/local/apache2 --enable-so --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre

================

  1. httpd编译安装
  2. ===========================================
  3. 官网:http://httpd.apache.org/
  4. 包:httpd-2.4.20.tar.bz2
  5. 注释:此处只考虑 2.4+ 的安装与配置,基于CentOS 6 和 CentOS 7。
  6. (1)环境准备。
  7. ~]# yum -y install gcc gcc-c++ apr-devel apr-util-devel pcre pcre-devel openssl openssl-devel
  8. ~]# tar -axf httpd-2.4.20.tar.bz2
  9. ~]# cd httpd-2.4.20/
  10. (2)注意事项。
  11. CentOS 6:注意事项
  12. apr 与 apr-util 官网下载地址:http://apr.apache.org/download.cgi
  13. 版本要求:
  14. (1) apr             version >= 1.4+
  15. ~]# ./configure  --prefix=/usr/local/apr
  16. ~]# make && make install
  17. (2) apr-util        version >= 1.4+
  18. ~]# ./configure  --prefix=/usr/local/apr-util  --with-apr=/usr/local/apr
  19. ~]# make && make install
  20. (3)编译安装。
  21. CentOS 6:
  22. ~]# ./configure --prefix=/usr/local/httpd --sysconfdir=/etc/httpd --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-modules=all --enable-mpms-shared=all --with-pcre --with-libxml2 --enable-cgi  --with-mpm=prefork
  23. CentOS 7:
  24. ~]#   ./configure --prefix=/usr/local/httpd --sysconfdir=/etc/httpd --enable-modules=all --enable-mpms-shared=all --with-pcre --with-libxml2 --enable-cgi  --with-mpm=prefork
  25. ~]# make && make install
  26. 注释:
  27. (1)--enable-mods-shared=all --enable-mods-static=all 只能选择一个,选择了 shared 之后还可以选择部分 static。(非必选)
  28. (2) --enable-load-all-modules 开启所有的选项,不要使用,开启了所有的会存在一些冲突,当需要的时候手动开启即可。
  29. (2)--enable-cgi 为模块。--with-pcre --with-libxml2 为扩展。(非必选)
  30. (3)--with-mpm=prefork 指定默认工作模型。(非必选)
  31. (4)--with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util  为 CentOS 6 系统的依赖。(CentOS 6 必选)
  32. 查看编译了那些模块:
  33. ~]# ls /usr/local/httpd/modules
  34. 查看加载了那些模块:
  35. ~]# /usr/local/httpd/bin/httpd -M
  36. ===============================================
  37. 常用选项解释:
  38. Configuration:
  39. -h, --help             显示帮助文档并退出
  40. Installation directories:
  41. --prefix=PREFIX         指定安装路径
  42. Fine tuning of the installation directories:
  43. --sysconfdir=DIR        指定配置文件路径
  44. Optional Features:
  45. --enable-load-all-modules     开启所有的加载模块
  46. --enable-modules=MODULE-LIST  开启模块 | "all" |"most" | "few" | "none" | "reallyall"
  47. --enable-mods-shared=MODULE-LIST    共享模块 |"all" | "most" | "few" | "reallyall"
  48. --enable-mods-static=MODULE-LIST   静态模块 |"all" | "most" | "few" | "reallyall"
  49. --enable-ssl            SSL/TLS :构建 https
  50. --enable-mpms-shared=MPM-LIST    共享模块 | "all"
  51. --enable-rewrite        url 重写
  52. --enable-vhost-alias    虚拟主机
  53. --enable-proxy-fcgi     FastCGI 模块
  54. --enable-so            允许运行时加载DSO模块
  55. Optional Packages:
  56. --with-apr=PATH         prefix for installed APR or the full path to apr-config
  57. --with-apr-util=PATH    prefix for installed APU or the full path to  apu-config
  58. --with-mpm=MPM        指定apache默认工作模式:MPM={event|worker|prefork|winnt}
  59. --with-pcre=PATH        perl语言兼容正则表达式)是一个用C语言编写的正则表达式函数库。
  60. --with-libxml2=PATH     Libxml2 是一个xml c语言版的解析器,还支持c++、PHP、Pascal、Ruby、Tcl等语言的绑定
  61. ========================================================
  62. 系统服务,启动,库,环境变量等设置。
  63. (1)测试是否正常。
  64. 自带启动脚本:
  65. /usr/local/httpd/bin/apachectl (start | stop | restart | graceful | graceful-stop)
  66. 查看端口80是否被监听:
  67. ss -tnl
  68. (2)加入环境变量
  69. 临时生效:
  70. ~]# export PATH=/usr/local/httpd/bin:$PATH
  71. 永久生效:
  72. ~]# vim /etc/profile.d/httpd.sh
  73. export PATH=/usr/local/httpd/bin:$PATH
  74. ~]# source /etc/profile.d/httpd.sh
  75. 测试:(apachectl 现在是一个命令)
  76. ~]# apachectl (start | stop | restart | graceful | graceful-stop)
  77. (3)导出库文件:
  78. ~]# ln -s /usr/local/httpd/include /usr/include/httpd
  79. (4)导出man手册
  80. CentOS 6:
  81. ~]# vim /etc/man.config
  82. CentOS 7:
  83. ~]# vi /etc/man_db.conf
  84. 写入:
  85. MANPATH /usr/local/httpd/man
  86. (5)服务脚本文件
  87. CentOS 6:新加启动脚本。
  88. ~]# vi /etc/rc.d/init.d/httpd
  89. -------------------------------------start----------------------------------------------
  90. #!/bin/bash
  91. #
  92. # httpd        Startup script for the Apache HTTP Server
  93. #
  94. # chkconfig: - 85 15
  95. # description: The Apache HTTP Server is an efficient and extensible  \
  96. #          server implementing the current HTTP standards.
  97. # processname: httpd
  98. # config: /etc/httpd/conf/httpd.conf
  99. # config: /etc/sysconfig/httpd
  100. # pidfile: /var/run/httpd/httpd.pid
  101. #
  102. ### BEGIN INIT INFO
  103. # Provides: httpd
  104. # Required-Start: $local_fs $remote_fs $network $named
  105. # Required-Stop: $local_fs $remote_fs $network
  106. # Should-Start: distcache
  107. # Short-Description: start and stop Apache HTTP Server
  108. # Description: The Apache HTTP Server is an extensible server
  109. #  implementing the current HTTP standards.
  110. ### END INIT INFO
  111. # Source function library.
  112. . /etc/rc.d/init.d/functions
  113. if [ -f /etc/sysconfig/httpd ]; then
  114. . /etc/sysconfig/httpd
  115. fi
  116. # Start httpd in the C locale by default.
  117. HTTPD_LANG=${HTTPD_LANG-"C"}
  118. # This will prevent initlog from swallowing up a pass-phrase prompt if
  119. # mod_ssl needs a pass-phrase from the user.
  120. INITLOG_ARGS=""
  121. # Set HTTPD=/usr/sbin/httpd.worker in /etc/sysconfig/httpd to use a server
  122. # with the thread-based "worker" MPM; BE WARNED that some modules may not
  123. # work correctly with a thread-based MPM; notably PHP will refuse to start.
  124. # Path to the apachectl script, server binary, and short-form for messages.
  125. apachectl=/usr/local/httpd/bin/apachectl
  126. httpd=${HTTPD-/usr/local/httpd/bin/httpd}
  127. prog=httpd
  128. pidfile=${PIDFILE-/usr/local/httpd/logs/httpd.pid}
  129. lockfile=${LOCKFILE-/var/lock/subsys/httpd}
  130. RETVAL=0
  131. STOP_TIMEOUT=${STOP_TIMEOUT-10}
  132. # The semantics of these two functions differ from the way apachectl does
  133. # things -- attempting to start while running is a failure, and shutdown
  134. # when not running is also a failure.  So we just do it the way init scripts
  135. # are expected to behave here.
  136. start() {
  137. echo -n $"Starting $prog: "
  138. LANG=$HTTPD_LANG daemon --pidfile=${pidfile} $httpd $OPTIONS
  139. RETVAL=$?
  140. echo
  141. [ $RETVAL = 0 ] && touch ${lockfile}
  142. return $RETVAL
  143. }
  144. # When stopping httpd, a delay (of default 10 second) is required
  145. # before SIGKILLing the httpd parent; this gives enough time for the
  146. # httpd parent to SIGKILL any errant children.
  147. stop() {
  148. echo -n $"Stopping $prog: "
  149. killproc -p ${pidfile} -d ${STOP_TIMEOUT} $httpd
  150. RETVAL=$?
  151. echo
  152. [ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
  153. }
  154. reload() {
  155. echo -n $"Reloading $prog: "
  156. if ! LANG=$HTTPD_LANG $httpd $OPTIONS -t >&/dev/null; then
  157. RETVAL=6
  158. echo $"not reloading due to configuration syntax error"
  159. failure $"not reloading $httpd due to configuration syntax error"
  160. else
  161. # Force LSB behaviour from killproc
  162. LSB=1 killproc -p ${pidfile} $httpd -HUP
  163. RETVAL=$?
  164. if [ $RETVAL -eq 7 ]; then
  165. failure $"httpd shutdown"
  166. fi
  167. fi
  168. echo
  169. }
  170. # See how we were called.
  171. case "$1" in
  172. start)
  173. start
  174. ;;
  175. stop)
  176. stop
  177. ;;
  178. status)
  179. status -p ${pidfile} $httpd
  180. RETVAL=$?
  181. ;;
  182. restart)
  183. stop
  184. start
  185. ;;
  186. condrestart|try-restart)
  187. if status -p ${pidfile} $httpd >&/dev/null; then
  188. stop
  189. start
  190. fi
  191. ;;
  192. force-reload|reload)
  193. reload
  194. ;;
  195. graceful|help|configtest|fullstatus)
  196. $apachectl $@
  197. RETVAL=$?
  198. ;;
  199. *)
  200. echo $"Usage: $prog {start|stop|restart|condrestart|try-restart|force-reload|reload|status|fullstatus|graceful|help|configtest}"
  201. RETVAL=2
  202. esac
  203. exit $RETVAL
  204. ---------------------------------------------------end------------------------------------------------
  205. CentOS 7 新加启动脚本:
  206. ~]# vi
  207. ---------------------------------------------------start------------------------------------------------
  208. ---------------------------------------------------end------------------------------------------------
  209. (6)开机启动
  210. CentOS 6:
  211. ~]# chkconfig --add httpd
  212. ~]# chkconfig --level 345 httpd on
  213. ~]# chkconfig --list httpd
  214. httpd          0:off   1:off   2:off   3:on    4:on    5:on    6:off
  215. CentOS 7:
  216. (7)系统启动与停止
  217. CentOS 6:
  218. service httpd (start | stop | restart)
  219. CentOS 7:
  220. systemctl (start | stop | restart) httpd.service
  221. (7)语法测试
  222. httpd -t

httpd编译安装的更多相关文章

  1. httpd编译安装php

    wget http://hk1.php.net/distributions/php-5.6.31.tar.gz yum groupinstall "Development Tools&quo ...

  2. 编译安装HTTPD 2.4.9版本

    编译安装HTTPD 2.4.9版本    服务脚本:/etc/rc.d/init.d/httpd    脚本配置文件路径:/etc/sysconfig/httpd    运行目录:/etc/httpd ...

  3. 把编译安装的httpd 实现服务脚本,通过service和chkconfig 进行管理

    把编译安装的httpd 实现服务脚本,通过service和chkconfig 进行管理 1 编译安装httpd 把httpd编译安装在/app/httpd/目录下. 2 在/etc/rc.d/init ...

  4. 编译安装的httpd实现服务脚本,通过service和chkconfig进行管理

    把编译安装的httpd 实现服务脚本,通过service和chkconfig 进行管理 1 编译安装httpd 把httpd编译安装在/app/httpd/目录下. 2 在/etc/rc.d/init ...

  5. LAMP环境之编译安装httpd服务

    “Apache HTTP Server”是开源软件项目的杰出代表,它基于标准的 HTTP 网络协议提供网页浏览服务. 在配置 Apache 网站服务之前,需要正确安装好 httpd 服务器软件.htt ...

  6. 编译安装基于 fastcgi 模式的多虚拟主机的wordpress和discuz的LAMP架构

    目录 实现CentOS 7 编译安装基于 fastcgi 模式的多虚拟主机的wordpress和discuz的LAMP架构 准备环境: 准备软件版本: 主机名修改用以区分 数据库服务器 实现数据库二进 ...

  7. 转-httpd 2.4.4 + mysql-5.5.28 + php-5.4.13编译安装过程

    一.编译安装apache 1.解决依赖关系 httpd-2.4.4需要较新版本的apr和apr-util,因此需要事先对其进行升级.升级方式有两种,一种是通过源代码编译安装,一种是直接升级rpm包.这 ...

  8. CentOS 6.4源码编译安装httpd并启动测试

    今天来总结一下在Linux中软件安装,通常我们应该知道,安装软件有两种方法:一种是软件包的安装,也就是rpm包的安装,就是指这些软件包都是 已经编译好的二进制rpm包,我们通过rpm安装工具和yum安 ...

  9. CentOS下编译安装Apache(httpd)

    官网下载最新版本的apache, apr, apr-util http://httpd.apache.org/download.cgi#apache24 http://apr.apache.org/d ...

随机推荐

  1. 一个免费ss网站的数据爬取过程

    一个免费ss网站的数据爬取过程 Apr 14, 2019 引言 爬虫整体概况 主要功能方法 绕过DDOS保护(Cloudflare) post中参数a,b,c的解析 post中参数a,b,c的解析 p ...

  2. awk处理excel表格数据

    拿到一个ip的excel表格,要对单元格中的ip进行扫描,一看有点乱,有空格分割的,有"/"分割的,有带括号(分割的,有好几百个: 要把左边的变为右边的格式,用excel自带的功能 ...

  3. 20145104张家明 《Java程序设计》第4周学习总结

    20145104张家明 <Java程序设计>第4周学习总结 教材学习内容总结 第六章 1.继承的定义及目的 面向对象中,子类继承父类,避免重复的行为定义.不过并非为了避免重复定义行为就使用 ...

  4. HeyWeGo第三周项目总结

    HeyWeGo第三周项目总结 项目进展 第三周的计划是:将收集到的资料和代码,进行汇总并且分工后开始开始撰写游戏代码与测试代码. 本周我们已经开始编写了自己负责部分的代码. 按照我们的计划,本周我们完 ...

  5. Installing VirtualBox DKMS in Kali 2.0

    Kali linux is one of the mainly used operating system by the Ethical hackers and information securit ...

  6. Python学习札记(二十二) 函数式编程3 filter & SyntaxError: unexpected EOF while parsing

    参考: filter Problem SyntaxError: unexpected EOF while parsing 遇到该语法错误,一般是由于 括号不匹配 问题. Note 1.filter 用 ...

  7. c++指向指针的指针与 c++指针作为函数参数传递问题

    一直搞不明白,c++中指针到底是个啥东西,今天遇到到c++,指向指针的指针的问题,突然有点开窍了. 举个例子: int main(int argc, char** argv){ int a[5]={1 ...

  8. DWZ 框架详解

    这是一个智障的框架,能别用就别用.

  9. 桌面以及任务栏的所有浏览器,被加上了 hao.360.cn的网址

    桌面以及任务栏的所有浏览器,被加上了hao.360.cn的网址 也不知道是安装了什么软件,中了360的招. 桌面以及任务栏的所有浏览器,被加上了hao.360.cn的网址. 这种东西,肯定是该死的36 ...

  10. link @import区别 src href的区别

    先说页面引入css的四种方式吧 1 在头部写在style里面 2 行内样式 tyle= 3 外部引入 link和@import的区别 link属于XHTML的标签,而@import只是css提供的一种 ...