编译httpd2.4.10踩坑记

作者【Jev Tse】【版权所有】  系统环境:centos6.8    

【本文概览】    
 零、httpd2.4.10编译总结    
    1、基础环境    
    2、依赖包组    
  一、安装前准备  
  二、编译踩坑    
    1、第一个坑:APR not found (ARP-Ulit not fount)    
    2、第二个坑:pcre-config for libpcre not found.    
    3、第三个坑:g++: command not found    
    4、第四个坑:make[1]: *** [libpcrecpp.la] Error 1    
    5、第五个坑:httpd报错AH00557 AH00558    
  三、测试服务    
  四、踩坑总结


零、httpd2.4.10编译总结

1、基础环境:
   安装"Development Tools"包组
   安装升级gcc、gcc-g++组件
2、依赖包组:
   apr、apr-ulit、pcre
   包组来源:
   wget http://archive.apache.org/dist/apr/apr-1.5.2.tar.gz
   wget http://archive.apache.org/dist/apr/apr-util-1.5.2.tar.gz
   wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.20/pcre-8.20.zip
   


一、安装前准备

1、系统环境:centos6.8

2、安装开发软件包组以及GCC:

[root@6 Jev Tse testdir]#yum groupinstall "Development Tools"
[root@6 Jev Tse testdir]#yum install gcc

3、解压httpd-2.4.10.tar.bz2

[root@6 Jev Tse testdir]#tar xvf httpd-2.4.10.tar.bz2 
[root@6 Jev Tse testdir]#cd httpd-2.4.10


二、编译踩坑

1、第一个坑:APR not found  (ARP-Ulit not fount)

鉴于我在centos7安装httpd-2.2.29的经验,直接./configure
[root@6 Jev Tse httpd-2.4.10]#./configure  --prefix=/usr/local/Jev-apache2
checking for APR... no
configure: error: APR not found .  Please read the documentation
查看安装相关文件
[root@6 Jev Tse testdir]#cat  README  INSTALL
*  *  *  *  *  *
Consider if you want to use a previously installed APR and APR-Util (such as those provided with many OSes) or if you need to use the APR and APR-Util from the apr.apache.org project. If the latter, download the latest versions and unpack them to ./srclib/apr and ./srclib/apr-util (no version numbers in the directory names) and use./configure's --with-included-apr option.
*  *  *  *  *  *
从INSTALL 得出:
安装环境需要安装apr 以及apr-ulit,并使用--with-included-apr的选项
# 安装apr-1.5.2组件
[root@6 Jev Tse httpd-2.4.10]#reset    #清理环境,排除其他干扰
[root@6 Jev Tse testdir]#wget  \
http://archive.apache.org/dist/apr/apr-1.5.2.tar.gz
[root@6 Jev Tse testdir]#tar vxf apr-1.5.2.tar.gz
[root@6 Jev Tse testdir]#cd apr-1.5.2
[root@6 Jev Tse apr-1.5.2]# cat README
[root@6 Jev Tse apr-1.5.2]# ./configure --prefix=/usr/local/apr
[root@6 Jev Tse apr-1.5.2]#make && make install
[root@6 Jev Tse apr-1.5.2]#echo $?   #查看返回值,确定操作无误
# 安装apr-util-1.5.2组件
[root@6 Jev Tse testdir]#wget \
http://archive.apache.org/dist/apr/apr-util-1.5.2.tar.gz
[root@6 Jev Tse testdir]# tar vxf apr-util-1.5.2.tar.gz
[root@6 Jev Tse testdir]#cd apr-util-1.5.2
[root@6 Jev Tse apr-util-1.5.2]#./configure --prefix=/usr/local/apr-util \
 --with-apr=/usr/local/apr
#安装环境需要安装apr 需使用--with-included-apr的选项
[root@6 Jev Tse apr-util-1.5.2]#make && make install
[root@6 Jev Tse apr-util-1.5.2]#echo $? #查看返回值,确定操作无误

2、第二个坑:pcre-config for libpcre not found.

#重新编译安装apache
[root@6 Jev Tse testdir]#cd /testdir/httpd-2.4.10
[root@6 Jev Tse Tse httpd-2.4.10]#./configure \
--prefix=/usr/local/Jev-apache2  \
--with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util
checking for pcre-config... false
configure: error: pcre-config for libpcre not found....
# 安装pcre-8.20组件
[root@6 Jev Tse testdir]#reset         #清理环境,排除其他干扰
[root@6 Jev Tse testdir]#wget \
http://jaist.dl.sourceforge.net/project/pcre/pcre/8.20/pcre-8.20.zip 
[root@6 Jev Tse testdir]#unzip -o pcre-8.20.zip 
[root@6 Jev Tse testdir]#cd pcre-8.20

3、第三个坑:g++: command not found

[root@6 Jev pcre-8.20]#./configure --prefix=/usr/local/pcre 
./libtool: line 990: g++: command not found
[root@6 Jev pcre-8.20]#reset
[root@6 Jev pcre-8.20]#yum install gcc-c++

4、第四个坑:make[1]: *** [libpcrecpp.la] Error 1

[root@6 Jev pcre-8.20]#./configure --prefix=/usr/local/pcre 
make[1]: *** [libpcrecpp.la] Error 1
make[1]: Leaving directory `/testdir/test1/pcre-8.20'
make: *** [all] Error 2
从网上查资料得到,需加--disable-shared --with-pic 选项
[root@6 Jev pcre-8.20]#reset             #清理环境,排除其他干扰
[root@6 Jev pcre-8.20]#./configure  --prefix=/usr/local/pcre \
 --disable-shared --with-pic   
[root@6 Jev pcre-8.20]#make && make install
[root@6 Jev pcre-8.20]#echo $?          #查看返回值,确定操作无误
#再次编译安装apache
[root@6 Jev pcre-8.20#reset             #清理环境,排除其他干扰
[root@6 Jev pcre-8.20]# cd ../httpd-2.4.10
[root@6 Jev httpd-2.4.10]#./configure --prefix=/usr/local/Jev-apache2 \
--with-apr=/usr/local/apr  --with-apr-util=/usr/local/apr-util/  \
--with-pcre=/usr/local/pcre
[root@6 Jev httpd-2.4.10]#make && make install
[root@6 Jev httpd-2.4.10]#echo $?        #查看返回值,确定操作无误
[root@6 Jev httpd-2.4.10]#cd ../
[root@6 Jev Tse testdir]#PATH=$PATH:/usr/local/ Jev-apache2/bin/  > \ 
/etc/profile.d/ Jev-apache2.sh                  #添加环境变量
[root@6 Jev Tse testdir]#source /etc/profile.d/ Jev-apache2.sh #加载环境变量

5、第五个坑:httpd报错AH00557 AH00558

[root@6 Jev Tse testdir]#apachectl start
AH00557: httpd: apr_sockaddr_info_get() failed for ...
AH00558: httpd:  ...
#经检测,这两个错误是apache主机名出错
#在httpd.conf 配置文件指定ServerName  host 即可
[root@6 Jev Tse testdir]# apachectl stop
[root@6 Jev Tse testdir]#vim  /usr/local/Jev-apache2/conf/httpd.conf
#在httpd.conf 配置文件加入“ServerName  172.16.250.69”
[root@6 Jev Tse testdir]# apachectl start
httpd (pid 58548) already running


三、测试服务

确认服务状态

[root@6 Jev Tse testdir]#netstat -ant |grep :80   #查看80端口是否正常
tcp       0     0 :::80       :::*     LISTEN
[root@6 Jev Tse testdir]#iptables –F          #清理防火墙
[root@6 Jev Tse testdir]#iptables –vnL        #确认防火墙状态
Chain INPUT (policy ACCEPT 11165 packets, 1052K bytes)
 pkts bytes target    prot opt in   out   source  destination        
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target    prot opt in   out   source  destination        
hain OUTPUT (policy ACCEPT 156 packets, 16554 bytes)
 pkts bytes target    prot opt in   out   source  destination
#编辑网页
[root@6.Jev Tse ~]#vim /usr/local/Jev-apache2/htdocs/index.html

apache踩坑记.png

经测试网页能正常访问,大功告成

apache踩坑记2.png


四、踩坑总结

1、编译软件前需看清楚,软件编译环境需求,可以避免不必要的麻烦。

2、编译出错后,用reset清理系统环境,排除其他干扰,再继续操作。

3、碰到错误,先根据错误提示以及安装帮助文档排错。

4、确实解决不了才到社区查找相关资料。


【回到页首】

作者【Jev Tse】【版权所有】

原创文章,作者:Jev Tse,如若转载,请注明出处:http://www.178linux.com/61405

(0)
Jev TseJev Tse
上一篇 2016-11-29 13:14
下一篇 2016-11-29 16:58

相关推荐

  • MAN手册各章节功能介绍及快捷键键位整理

       初学linux ,请教别人的时候,遇到人不耐烦回答我等菜菜的问题,都会说一句,“自己去man”,“翻过man了吗,再来问吧”,哦,my gd,这个man到底是何方超人啊,其实man就是linux自带的文档,假如你不知道ls这个命令的用法,你可以试着敲入 man  ls  ,然后来看看,会有啥结果。效果不错吧,一般…

    Linux干货 2016-10-18
  • Linux中的网络管理

    1. ifconfig命令的使用方法 ifconfig是一个比较老的命令了,以后可能会慢慢被ip命令替代。ifconfig命令可以用来配置网卡ip地址,配置网卡别名等信息。 ifconfig ifconfig 网络设备名:用来查看网卡的信息,如ip地址,子网掩码,MAC地址等信息 ifconfig eth0 add 172.16.0.35/16:配置eth0…

    2017-05-02
  • sed使用小命令及课后作业

    Stream EDitor,  行编辑器 sed 是一种流编辑器,它一次处理一行内容。处理时,把当前处理的行存储在临时缓冲区中,称为“模式空间”(pattern space ),接着用sed 命令处理缓冲区中的内容,处理完成后,把缓冲区的内容送往屏幕。接着处理下一行,这样不断重复,直到文件末尾。文件内容并没有改变,除非你使用重定向存储输出。Sed …

    Linux干货 2017-03-18
  • Linux基础之安全加密及CA、证书实战应用

    一、建立私有CA并让客户端申请请求,需要两台虚拟机完成 1、建立私有CA,生成私钥 2、CA公司给自己,生成自签证书 3、为CA提供所需要的目录及文件(如果事先存在,此步骤可以跳过) 二、CA公司已建立,需要一台客户机配合CA签署证书 1、客户端用到证书,因此生成私钥 2、客户端生成证书签署请求 3、将请求通过可靠方式发送给CA主机,这里作为测试,因此使用s…

    Linux干货 2016-10-04
  • 内核及模块管理

    内核及模块管理基础 查询程序的依赖库 ldd命令ldd [OPTION]…FILE…     [root@centos6 ~]# ldd /bin/ls         linux-vd…

    Linux干货 2016-09-19
  • 第七周作业

    第七周 1,创建一个10G分区,并格式化为ext4文件系统;(1) 要求其block大小为2048,预留空间百分比为2,卷标为MYDATA,默认挂载属性包含acl;(2) 挂载至/data/mydata目录,要求挂载时禁止程序自动运行,且不更新文件的访问时间戳; [root@www ~]# fdisk /dev/sda <————-fd…

    Linux干货 2017-09-03

评论列表(1条)

  • Kaydence
    Kaydence 2017-04-24 05:08

    Intéressant cet article, on parle souvent du vent dans le SEO, mais jamais du néant!Et pourtant il est vraiment important de savoir gérer l’espace, un peu comme sa respiration dans une longue phrase. Sinon le visiteur/auditeur décroche et zappe…Ca me rappelle deux acronymes ricains que j&oequr;affsctionne : KISS, « keep it stupid and simple » et le fameux « less is more » !