背景描述:
最近集团在做安全扫描,扫出了http的漏洞,一看是监控nagios涉及到的httpd,于是就考虑将httpd升级到最新的版本,在升级的过程中,真是遇到了很多的坑,弄了2天终于搞定了,现在梳理下相应的错误处理过程及解决的方法。
环境信息:
apache httpd版本:Apache/2.2.15
OS版本:Red Hat Enterprise Linux Server release 6.6 (Santiago)
httpd 2.2 升级到 2.4的过程【采用重新安装一个最新版本,然后加载原配置的方法】:
1.下载最新的httpd软件包,此处用的软件包版本
httpd-2.4.39.tar.gz
下载地址:http://httpd.apache.org/download.cgi
2.将软件上传到服务器上(注意使用root用户上传)
3.解压,检查环境配置
[root@hadoop1 softwares]# tar -zxf httpd-2.4.39.tar.gz [root@hadoop1 softwares]# cd httpd-2.4.39 [root@hadoop1 httpd-2.4.39]# ./configure --prefix=/usr/local/httpd-2.4.39
有如下报错信息:
[root@hadoop1 httpd-2.4.39]# ./configure --prefix=/usr/local/httpd-2.4.39 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-pc-linux-gnu checking host system type... x86_64-pc-linux-gnu checking target system type... x86_64-pc-linux-gnu configure: configure: Configuring Apache Portable Runtime library... configure: checking for APR... configure: WARNING: APR version 1.4.0 or later is required, found 1.3.9 configure: WARNING: skipped APR at apr-1-config, version not acceptable no configure: error: APR not found. Please read the documentation.
通过以上的报错信息知道,缺少apr的包,下载apr相关的包
4.下载apr对应软件包,下载以下2个包
5.将apr及apr-util的包解压到httpd解压之后的目录中,放到srclib目录下
[root@hadoop1 httpd-2.4.39]# pwd /opt/softwares/httpd-2.4.39 [root@hadoop1 httpd-2.4.39]# ls ABOUT_APACHE apache_probes.d BuildBin.dsp config.layout configure.in httpd.dsp INSTALL libhttpd.dsp Makefile.win os ROADMAP test acinclude.m4 ap.d buildconf config.log docs httpd.mak InstallBin.dsp libhttpd.mak modules README server VERSIONING Apache-apr2.dsw build CHANGES config.nice emacs-style httpd.spec LAYOUT LICENSE NOTICE README.cmake srclib Apache.dsw BuildAll.dsp CMakeLists.txt configure httpd.dep include libhttpd.dep Makefile.in NWGNUmakefile README.platforms support [root@hadoop1 httpd-2.4.39]# cd srclib/ [root@hadoop1 srclib]# ll total 4 -rw-r--r-- 1 root dip 121 Feb 11 2005 Makefile.in
将apr及apr-util解压到该目录下
[root@hadoop1 softwares]# tar -zxf apr-1.7.0.tar.gz -C ./httpd-2.4.39/srclib/ [root@hadoop1 softwares]# tar -zxf apr-util-1.6.1.tar.gz -C ./httpd-2.4.39/srclib/ [root@hadoop1 softwares]# cd httpd-2.4.39/srclib/ [root@hadoop1 srclib]# ls apr-1.7.0 apr-util-1.6.1 Makefile.in [root@hadoop1 srclib]# mv apr-1.7.0/ apr [root@hadoop1 srclib]# mv apr-util-1.6.1/ apr-util [root@hadoop1 srclib]# ls apr apr-util Makefile.in
6.重新检查httpd的配置
[root@hadoop1 httpd-2.4.39]# ./configure --prefix=/usr/local/httpd-2.4