SHELL脚本安装apache,解决configure: error: APR not found
Posted 运维邦
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了SHELL脚本安装apache,解决configure: error: APR not found相关的知识,希望对你有一定的参考价值。
各种报错 ‘onfigure: error: APR not found . Please read the documentation’
#清理已经安装包
rpm -e httpd
rpm -e mysql
rpm -e php
yum -y remove httpd
yum -y remove mysql
yum -y remove php
#搜索apache包
rpm -qa http*
#强制卸载apache包
rpm -e --nodeps 查询出来的文件名
#检查是否卸载干净
rpm -qa|grep http*
selinux可能会致使编译安装失败,可以先禁用:
永久禁用,需要重启生效
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
临时禁用,不需要重启
setenforce 0
2、安装必备工具
yum -y install make gcc gcc-c++ gcc-g77 flex bison file libtool libtool-libs autoconf kernel-devel libjpeg libjpeg-devel libpng libpng-devel libpng10 libpng10-devel gd gd-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glib2 glib2-devel bzip2 bzip2-devel libevent libevent-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel gettext gettext-devel ncurses-devel gmp-devel pspell-devel unzip libcap lsof
为了保守起见,把相关关联包都安装一下:
1、下载相关的包
wget http://archive.apache.org/dist/apr/apr-1.4.5.tar.gz
wget http://archive.apache.org/dist/apr/apr-util-1.3.12.tar.gz
wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.10/pcre-8.10.zip
2、解决apr not found
[root@lme test]# tar -zxf apr-1.4.5.tar.gz
[root@lme test]# cd apr-1.4.5
[root@lme apr-1.4.5]# ./configure --prefix=/usr/local/apr
[root@lme apr-1.4.5]# make && make install
3、解决APR-util not found
[root@lme test]# tar -zxf apr-util-1.3.12.tar.gz
[root@lme test]# cd apr-util-1.3.12
[root@lme apr-util-1.3.12]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config --enable-utf8
[root@lme apr-util-1.3.12]# make && make install
4、解决pcre问题
[root@lme test]#unzip -o pcre-8.10.zip
[root@lme test]#cd pcre-8.10
[root@lme pcre-8.10]#./configure --prefix=/usr/local/pcre
[root@lme pcre-8.10]#make && make install
开始倒腾脚本:
#!/bin/bash
#install http path
H_URL=http://mirrors.sohu.com/apache/
H_FILES=httpd-2.4.29.tar.bz2
H_PREFIX=/usr/local/apache
H_FILES_DIR=httpd-2.4.29
#install apache server
if [[ $1 -eq 1 ]];then
wget -c $H_URL/$H_FILES && tar -jxvf $H_FILES && cd $H_FILES_DIR &&./configure --prefix=$H_PREFIX --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre
if [[ $? -eq 0 ]];then
make && make install
echo -e "\033[32m---Apache install successful---\033[0m"
else
echo -e "\033[32m---Apache install failed---\033[0m"
exit 0
fi
fi
最后启动:
/usr/local/apache/bin/apachectl start
以上是关于SHELL脚本安装apache,解决configure: error: APR not found的主要内容,如果未能解决你的问题,请参考以下文章