wlzxwfk 发表于 2015-11-24 10:14:07

postfix安装(二)-- apache

  安装apache有点曲折,主要是apr导致的
  安装包: httpd-2.4.1.tar.bz2
  下载地址:http://www.apache.org
  
首先要定义一个完整的主机名 :
否则在启动apache的时候会有这样的报错:
  AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using ::1. Set the 'ServerName' directive globally to suppress this message
  
  编辑 /etc/sysconfig/network 文件,然后重启才能生效
  开始安装
  ]# chmod +x httpd-2.4.1.tar.bz2

]# tar jxf httpd-2.4.1.tar.bz2



]# cd httpd-2.4.1

]# ./configure --prefix=/usr/local/apache

checking for APR... no

configure: error: APR not found.Please read the documentation.



发现没有安装apr相关包,然后就用yum批量安装

]# yum install apr apr-util apr-devel apr-util-devel apr-util-mysql -y





再次运行configure出现这个报错:

checking for pcre-config... false

configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/



解救措施就是安装pcre相关包

]# yum install pcre pcre-devel pcre-static -y





]# rpm -qa |grep pcre

pcre-7.8-3.1.el6.x86_64

pcre-devel-7.8-3.1.el6.x86_64





]# make

rotatelogs.c:(.text+0x5ed): undefined reference to `apr_file_link'

collect2: ld returned 1 exit status

make: *** Error 1



检查apr包是否已经安装,事实证明已经安装过了

# rpm -qa |grep apr

apr-1.3.9-3.el6.x86_64

apr-util-1.3.9-3.el6.x86_64

apr-devel-1.3.9-3.el6.x86_64

apr-util-devel-1.3.9-3.el6.x86_64

apr-util-ldap-1.3.9-3.el6.x86_64


  试了几次都是同样的报错,把rpm包都卸载了,安装apr源码包

apr-1.3.8.tar.gz

apr-util-1.3.8.tar.gz



安装apr-util的时候需要指定apr的路径 --with-apr=/usr/local/apr





重新安装apache
  ./configure --prefix=/usr/local/apache --with-apr-util=/usr/local/apr-util
  在make install的时候,SB错误又出现了
  .libs/rotatelogs.o: In function `post_rotate':

/home/software/httpd-2.4.1/support/rotatelogs.c:298: undefined reference to `apr_file_link'

collect2: ld returned 1 exit status


  


  看来不是apr包的问题了,难道是哪个地方没有配置么 ?
  ]# ./configure --prefix=/usr/local/apache/ --with-apr=/usr/local/apr/bin/apr-1-config --with-lib=/usr/local/apr/lib/ --with-apr-util=/usr/local/apr-util/


  再续!!!!
  今天又回来继续这个问题
  我把apr和apr-util全都make clean然后删掉安装路径相关的文件/usr/local/apr
  在apache官方网站上重新下载的apr包 apr-util包和httpd包
  http://mirror.bit.edu.cn/apache//apr/


  apr-1.4.5.tar.gz


  apr-util-1.3.8.tar.gz


  


  http://mirror.bit.edu.cn/apache//httpd/


  

httpd-2.4.1.tar.gz   

  
  在中途中除了遇到这样一个蹩脚错误,我也不知道什么原因导致的,就用yum install libtool -y 就ok了
  info.lo   -lrt -lcrypt-lpthread

libtool: link: `strings/apr_strings.lo' is not a valid libtool object

make: *** 错误 1

# libtool: link: `strings/apr_strings.lo' is not a valid libtool object

make: *** 错误 1

make: Leaving directory `/home/software/apr-1.4.5'

make: *** 错误 1


  


  重新整理一下安装思路:
  安装环境:
  ]# yum install libtool apr apr-util apr-devel apr-util-devel apr-util-mysqlpcre pcre-devel pcre-static -y


  安装apr
  ./configure --prefix=/usr/local/apr
  make && make install
  


  安装apr-util
  ./configure --with-apr=/usr/local/apr
  make && make install
  


  安装http
  ./configure --prefix=/usr/local/apache--with-apr=/usr/local/apr/bin/apr-1-config --with-lib=/usr/local/apr/lib
  make && make install


  


  如果apr和apr安装完整的话,再安装http,应该没问题,我觉得我的apr和apr-util没有安装完整
  功夫不负有心人哟,O(∩_∩)O
  -------------------------------------------------------
  ]# cp /home/software/httpd-2.4.1/support/apachectl /etc/init.d/httpd


  开机自启动
  将service httpd start 加入文件 /etc/rc.d/rc.local
  启动服务
  ]# service httpd start

AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using ::1. Set the 'ServerName' directive globally to suppress this message




  ]# ps aux |grep http

root      85710.00.1712282588 ?      Ss   17:03   0:00 /usr/local/apache/bin/httpd -k start

daemon    85720.00.2 4154884460 ?      Sl   17:03   0:00 /usr/local/apache/bin/httpd -k start

daemon    85730.00.2 4154884464 ?      Sl   17:03   0:00 /usr/local/apache/bin/httpd -k start

daemon    85740.00.2 4154884468 ?      Sl   17:03   0:00 /usr/local/apache/bin/httpd -k start

root      86580.00.0 105388   888 pts/0    S+   17:03   0:00 grep http




  ]# netstat -anpt |grep 80

tcp      0      0 :::80                     :::*                        LISTEN      8571/httpd


  


  另外chkconfig不支持httpd,那么可以用以下方式实现开机自动启动:
  

]# vi /etc/init.d/httpd 在#/bin/sh下加入下列两行

       #chkconfig:2345 57 57

       #description:Apache

    PS:开头必须得加#,要不然还是不支持chkconfig

  

]# ln -s /etc/init.d/httpd /etc/rc.d/rc2.d/S57httpd

]# ln -s /etc/init.d/httpd /etc/rc.d/rc53d/S57httpd

]# ln -s /etc/init.d/httpd /etc/rc.d/rc4.d/S57httpd

]# ln -s /etc/init.d/httpd /etc/rc.d/rc5.d/S57httpd

]# chkconfig --add httpd

]# chkconfig --list |grep httpd


  


  检测服务
  然后在本机的浏览器地址栏中输入localhost:80,看一下是否显示“It Works”的提示



  


  


  
页: [1]
查看完整版本: postfix安装(二)-- apache