编译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
下一篇 2016-11-29

相关推荐

  • grub.config文件加密

    作用 在开机启动临时进入1模式的时候,系统先调用/etc/grub.conf。 /etc/grub.conf其实是/boot/grub/grub.conf的软连接。 加密改文件就有效的防止其他用户直接绕过口令登陆1模式,从而进入到root中做一些破坏。 我们可以看一下如何进入1模式。   我们可以看一下临时进入init1模式的窗口 这里的内容与gr…

    2017-07-22
  • 文件查找find与压缩

    1.locate:   locate是查询系统上预建的文件索引数据库    /var/lib/mlocate/mlocate.db   依赖于事先构建的索引   索引的构建是在系统较为空闲时自动进行(周期性任务),管理 员手动更新数据库(updatedb)    缺点:索引构建过…

    Linux干货 2016-08-18
  • Linux第三周

    一.正则表达式和扩展正则表达式 1.首先有各种工具来对文本进行的查看,分析,统计   cat 命令:查看文本的工具    cat主要有三大功能:1.一次显示整个文件。$ cat filename2.从键盘创建一个文件。$ cat > filename     只能创建新文件,不能编辑已有文件.…

    2017-06-04
  • 4

    1;复制/etc/skel目录为/home/tuinser1, 要求/home/tuser1及其内部文件的属组和其它用户均没有任何访问权限。 #   install -d -m 700 /etc/skel /home/tuser1  #  &nbsp…

    Linux干货 2017-01-16
  • 计算机的组成和其功能

    图:计算机组成架构 计算机由硬件和软件组成 硬件部分: CPU:又称中央处理器,整个系统最高执行单元,执行各种运算,控制电脑自动协调地完成各种操作。 主板:它把计算机的各个部件紧密的连接在一起,各个部件通过主板进行数据传输,计算机重要的“交通枢纽”都在主板上,他的工作稳定性影响整机的工作稳定性。因同CPU的插脚和性能不同,所以针对不同的CPU也有不同的主板。…

    Linux干货 2016-08-08
  • Xtrabackup进行MySQL备份

    使用Xtrabackup进行MySQL备份 一、安装 1、简介 Xtrabackup是由percona提供的mysql数据库备份工具,据官方介绍,这也是世界上惟一一款开源的能够对innodb和xtradb数据库进行热备的工具。 特点: (1)备份过程快速、可靠; (2)备份过程不会打断正在执行的事务; (3)能够基于压缩等功能节约磁盘空间和流量; (4)自动…

    Linux干货 2017-02-20

评论列表(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 » !