---
title: "SUSE EL下编译Apache"
author: "javaeye_mao"
date: "2012-06-11T22:31:05Z"
tags: []
categories: ["Web前端"]
slug: "suse-el-apache"
draft: false
lastmod: "2012-06-11T22:31:05Z"
id: 1558715
url: "https://javaeye-mao.iteye.com/blog/1558715"
---

SUSE EL 9  
httpd-2.2.4

1  
先将系统安装时安装的APACHE2卸载掉  
rpm -e apache2  
然后会提示很多依赖需要先卸载，再一一先卸载后即可卸载完出现两个相互依赖的则需要使用  
rpm -e apache2 --nodeps

2  
#tar -zxvf httpd-2.2.4.tar.gz  
#cd httpd-2.2.4  
#./configure --prefix=/opt/app/apache-2.2.2 \\  
\--enable-ssl --enable-so --disable-info \\  
\--enable-shared=max --enable-module=most \\  
\--enable-expires --enable-headers \\  
\--enable-rewrite

配置时报错：“cannot use an external APR with the bundled APR-util”

解决方法：  
APR了，这个东西是Apache可移植运行库，源自为了服务器代码的多平台性， 尝试将不同的操作系统特定字节与操作系统无关代码隔离。结果就提供了一个基础API的接口。

apache-2.2.0提供了apr以及apr-util的源代码   
要使用发行源代码中自带的apr/apr-util源代码进行安装，你必须手动完成： 

我们先编译和安装 apr 1.2   
\# tar xzvf httpd -2.2.0.tar.gz   
\# cd httpd-2.2.0   
\# cd srclib/apr   
\# ./configure --prefix=/usr/local/apr   
\# make   
\# make install 

现在编译和安装 apr-util 1.2   
\# cd ../apr-util   
\# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/   
\# make   
\# make install 

重复上面的./configure 报错：  
“exports.c:1653: error: redefinition of 'ap\_hack\_apr\_version\_string'  
exports.c:1022: error: previous definition of 'ap\_hack\_apr\_version\_string' was here  
make\[2]: \*\** \[exports.lo] Error 1  
make\[2]: Leaving directory \`/usr/local/src/httpd-2.2.4/server'  
make\[1]: \*\** \[all-recursive] Error 1  
make\[1]: Leaving directory \`/usr/local/src/httpd-2.2.4/server'  
make: \*\** \[all-recursive] Error 1”

解决办法：  
在configure后加上 “--with-included-apr”即可。