apache安装错误error: APR notfound解决办法
linux安装时安装种类不同,一些组件包可能不会被安装,导致linux下安装软件的时候缺这个缺那个,今天为大家介绍linux安装apache时报apr找不到的解决办法
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 wgethttp://jaist.dl.sourceforge.net/project/pcre/pcre/8.10/pcre-8.10.zip
2. 解压依赖包
3. 安装apr-1.4.5
进入安装目录
cd /opt/apr-1.4.5/
安装及编译
./configure --prefix=/usr/local/apr
make && make install
4. 后面可能还会出现找不到apr-util
进入安装目录
cd /opt/apr-util-1.3.12/
安装及编译
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config
make && make install
5. 后面可能还会出现找不到pcre
6. 重新安装apache
进入安装目录
cd /opt/httpd-2.4.10/
安装及编译
需要用--with参数指定我们刚才安装的依赖包位置
./configure --prefix=/usr/local/apache--with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/--with-pcre=/usr/local/pcre
make && make install
注意::
若发现启动时会出错/mod_dir.so: undefined symbol: apr_array_clear
改为使用--with-included-apr 及指定pcre-config,可以正常启动:
tar -zxvf apr-1.4.6.tar.gz
tar -zxvf apr-util-1.5.2.tar.gz
cd httpd-2.4.4
mv ../apr-1.4.6 srclib/apr
mv ../apr-util-1.5.2 srclib/apr-util
./configure --with-included-apr --with-pcre=/usr/local/bin/pcre-config --with-layout=Apache--enable-modules=most --enable-mods-shared=list --with-mpm=prefork
看来还是--with-included-apr 最可靠!
以下是安装命令history
1031 mkdir apacheNew
1032 cdapacheNew/
1033 wgethttp://archive.apache.org/dist/apr/apr-1.4.5.tar.gz
1034 wget http://archive.apache.org/dist/apr/apr-util-1.3.12.tar.gz
1035 wgethttp://jaist.dl.sourceforge.net/project/pcre/pcre/8.10/pcre-8.10.zip
//解压上面三个文件
1036 cdapr-1.4.5
1037 ./configure --prefix=/usr/local/apr
1038 make
1039 make install
1040 cd..
1041 cdapr-util-1.3.12
1042 ./configure --prefix=/usr/local/apr-util -with-apr=/usr/local/apr/bin/apr-1-config
1043 ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config
1044 ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
1045 make
1046 make install
1047 cd..
1048 cdpcre-8.10
1049 ./configure --prefix=/usr/local/pcre
1050 make
1051 make install
1052 cd..
1053 ll
1054 cdhttpd-2.4.27/
1055 ./configure --prefix=/usr/local/apache --with-apr=/usr/local/apr--with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre
1056 make
1057 make install
1125 cd httpd-2.4.27/
1126 ls
1127 mv../apr-1.4.5 srclib/apr -R
1128 ls./srclib (红色表示无效/错误命令)
1129 mv../apr-1.4.5 srclib/apr
1130 mv../apr-util-1.3.12 srclib/apr-util
1131 ls./srclib
1132 ./configure --prefix=/usr/local/apache --with-included-apr --with-pcre=/usr/local/pcre--with-layout=Apache --enable-modules=most --enable-mods-shared=list--with-mpm=prefork
1133 make
1134 make install
1135 /usr/local/apache/bin/apachectl start
1136 /usr/local/apache/bin/apachectl stop
1137 /usr/local/apache/bin/apachectl start
1138 ls/usr/local
借鉴:
https://jingyan.baidu.com/article/4b07be3c5cd75348b380f3c3.html
http://www.2cto.com/os/201305/209670.html