ICode9

精准搜索请尝试: 精确搜索
首页 > 系统相关> 文章详细

Centos6.8下编译安装Apache 2.4.25详细过程

2021-05-10 11:55:11  阅读:198  来源: 互联网

标签:25 configure ... -- apr Centos6.8 Apache local usr


一、下载源码安装包

# cd /usr/local/src
# wget 'http://mirror.bit.edu.cn/apache//httpd/httpd-2.4.25.tar.gz'


二、解压安装

# tar zxf httpd-2.4.25.tar.gz
# cd httpd-2.4.25
# ./configure --prefix=/usr/local/apache --enable-so --enable-rewrite --with-mpm=worker

在这过程中报错如下:

checking for chosen layout... Apache
checking for working mkdir -p... yes
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
configure: 
configure: Configuring Apache Portable Runtime library...
configure: 
checking for APR... no
configure: error: APR not found.  Please read the documentation.


解决APR not found 过程如下:

# cd /usr/local/src
# wget http://archive.apache.org/dist/apr/apr-1.5.2.tar.gz
# tar zxf apr-1.5.2.tar.gz
# ./configure --prefix=/usr/local/apr 
# make && make install


在编译apr的的过程中报错如下:

configure: creating ./config.status
config.status: creating Makefile
config.status: creating include/apr.h
config.status: creating build/apr_rules.mk
config.status: creating build/pkg/pkginfo
config.status: creating apr-1-config
config.status: creating apr.pc
config.status: creating test/Makefile
config.status: creating test/internal/Makefile
config.status: creating include/arch/unix/apr_private.h
config.status: executing libtool commands
rm: cannot remove `libtoolT': No such file or directory
config.status: executing default commands


解决方法如下:
在configure里面 RM='$RM  -f'   这里的$RM后面一定有一个空格。 如果后面没有空格,直接连接减号,就依
然会报错。把RM='$RM'改为RM='$RM  -f'
 
接着重新编译Apache:

./configure --prefix=/usr/local/apache --enable-so --enable-rewrite --with-mpm=worker --with-apr=/usr/local/apr

报错如下:

checking for chosen layout... Apache
checking for working mkdir -p... yes
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
configure: 
configure: Configuring Apache Portable Runtime library...
configure: 
checking for APR... yes
  setting CC to "gcc"
  setting CPP to "gcc -E"
  setting CFLAGS to " -g -O2 -pthread"
  setting CPPFLAGS to " -DLINUX -D_REENTRANT -D_GNU_SOURCE"
  setting LDFLAGS to " "
configure: 
configure: Configuring Apache Portable Runtime Utility library...
configure: 
checking for APR-util... no
configure: error: APR-util not found.  Please read the documentation.


解决APR-util not found过程:

# wget 'http://archive.apache.org/dist/apr/apr-util-1.5.2.tar.gz'
# tar zxf apr-util-1.5.2.tar.gz
# cd apr-util-1.5.2
# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config
# make && make install


编译完成后,我们再次重新编译Apache:

# ./configure --prefix=/usr/local/apache --enable-so --enable-rewrite --with-mpm=worker --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util

enable-so 允许apache支持动态模块 enable-rewrite 支持URL重定向  with-mpm=worker apache进程模型为worker 默认为prefork
 
最后:

# make && make install

到这编译就算完成了。

图片


标签:25,configure,...,--,apr,Centos6.8,Apache,local,usr
来源: https://blog.51cto.com/u_15127621/2765116

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有