apache在SUSE linux下的源码安装配置(httpd-2.2.22)
1. 下载httpd:http://labs.renren.com/apache-mirror/httpd/,下载了httpd-2.4.2.tar.gz
2. 安装apache
#tar zxvf httpd-2.4.2.tar.gz
#cd httpd-2.4.2
#./configure --prefix=/usr/local/apache --enable-modules=most --enable-mods-shared=max
出现错误如下
checking for APR... no
configure: error: APR not found. Please read the documentation.
Apr系统中没有,于是用zypper在线下载安装
# zypper search APR
正在恢复系统源…
对以下项的元数据进行语法分析SUSE Linux Enterprise Server 10 SP4...
S | Catalog | Type | Name | Version | Arch
--+-------------------------------------+---------+--------------------+-------- --------+-----
| SUSE Linux Enterprise Server 10 SP4 | package | libapr-util1 | 1.2.2-1 3.13.18 | i586
| SUSE Linux Enterprise Server 10 SP4 | package | libapr-util1-devel | 1.2.2-1 3.13.18 | i586
| SUSE Linux Enterprise Server 10 SP4 | package | libapr1 | 1.2.2-1 3.8.1 | i586
| SUSE Linux Enterprise Server 10 SP4 | package | libapr1-devel | 1.2.2-1 3.8.1 | i586
linux-ku0s:/home/archerwu/code/httpd-2.4.2 # zypper install libapr-util1 libapr- util1-devel libapr1 libapr1-devel
正在恢复系统源…
对以下项的元数据进行语法分析SUSE Linux Enterprise Server 10 SP4...
正在对 RPM 数据库进行语法分析...
摘要:
<install>[S1:1][package]libapr-util1-1.2.2-13.13.18.i586
<install>[S1:1][package]libapr-util1-devel-1.2.2-13.13.18.i586
<install>[S1:1][package]libapr1-1.2.2-13.8.1.i586
<install>[S1:1][package]libapr1-devel-1.2.2-13.8.1.i586
是否继续? [y/n]: y
Downloading: [S1:1][package]libapr1-1.2.2-13.8.1.i586, 99.0 K(238.3 K unpacked)
Installing: [S1:1][package]libapr1-1.2.2-13.8.1.i586
Downloading: [S1:1][package]libapr-util1-1.2.2-13.13.18.i586, 59.9 K(134.9 K unp acked)
Installing: [S1:1][package]libapr-util1-1.2.2-13.13.18.i586
Downloading: [S1:1][package]libapr1-devel-1.2.2-13.8.1.i586, 545.7 K(4.6 M unpac ked)
Installing: [S1:1][package]libapr1-devel-1.2.2-13.8.1.i586
Downloading: [S1:1][package]libapr-util1-devel-1.2.2-13.13.18.i586, 243.6 K(2.1 M unpacked)
Installing: [S1:1][package]libapr-util1-devel-1.2.2-13.13.18.i586
接着运行
#./configure --prefix=/usr/local/apache --enable-modules=most --enable-mods-shared=max
出现如下问题:
checking for pcre-config... false
configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/
仍然用zypper安装
linux-ku0s:/home/archerwu/code/httpd-2.4.2 # zypper search pcre-config
正在恢复系统源…
对以下项的元数据进行语法分析SUSE Linux Enterprise Server 10 SP4...
No packages found.
没办法,只能在网上下载。
在souceforge上下载了pcre-8.30.zip
直接./configure;make;make install安装
然后再#./configure --prefix=/usr/local/apache --enable-modules=most --enable-mods-shared=max
出现如下错误
checking for APR version 1.3.0 or later... no
configure: error: APR version 1.3.0 or later is required
由于系统是SLES10,对应的apr版本才1.2.2,而http版本比较新,所以改用较低版本再尝试,换成httpd-2.2.22.tar.gz
之后./configure通过,但是make的时候出错
In file included from /home/archerwu/code/httpd-2.2.22/include/util_ldap.h:31,
from exports.c:38:
/usr/include/apr-1/apr_ldap.h:67:18: error: lber.h: No such file or directory
/usr/include/apr-1/apr_ldap.h:68:18: error: ldap.h: No such file or directory
/usr/include/apr-1/apr_ldap.h:97:2: error: #error Support for LDAP v2.0 toolkits has been removed from apr-util. Please use an LDAP v3.0 toolkit.
In file included from /usr/include/apr-1/apr_ldap.h:120,
from /home/archerwu/code/httpd-2.2.22/include/util_ldap.h:31,
from exports.c:38:
/usr/include/apr-1/apr_ldap_init.h:112: error: expected declaration specifiers or '...' before 'LDAP'
In file included from /usr/include/apr-1/apr_ldap.h:121,
from /home/archerwu/code/httpd-2.2.22/include/util_ldap.h:31,
from exports.c:38:
/usr/include/apr-1/apr_ldap_option.h:204: error: expected declaration specifiers or '...' before 'LDAP'
/usr/include/apr-1/apr_ldap_option.h:226: error: expected declaration specifiers or '...' before 'LDAP'
In file included from exports.c:38:
/home/archerwu/code/httpd-2.2.22/include/util_ldap.h:89: error: 'LDAP_DEREF_NEVER' undeclared here (not in a function)
/home/archerwu/code/httpd-2.2.22/include/util_ldap.h:90: error: 'LDAP_DEREF_SEARCHING' undeclared here (not in a function)
/home/archerwu/code/httpd-2.2.22/include/util_ldap.h:91: error: 'LDAP_DEREF_FINDING' undeclared here (not in a function)
/home/archerwu/code/httpd-2.2.22/include/util_ldap.h:92: error: 'LDAP_DEREF_ALWAYS' undeclared here (not in a function)
/home/archerwu/code/httpd-2.2.22/include/util_ldap.h:97: error: expected specifier-qualifier-list before 'LDAP'
make[2]: *** [exports.lo] 错误 1
make[2]: Leaving directory `/home/archerwu/code/httpd-2.2.22/server'
make[1]: *** [all-recursive] 错误 1
make[1]: Leaving directory `/home/archerwu/code/httpd-2.2.22/server'
make: *** [all-recursive] 错误 1
估计大概是ldap没安装引起的问题,于是用zypper安装ldap
#zypper install ldapcpplib ldapcpplib-devel openldap2 openldap2-devel
然后再#make
出现如下问题
modules/http/.libs/libmod_http.a(byterange_filter.o): In function `ap_set_byterange':
byterange_filter.c:(.text+0x1201): undefined reference to `apr_array_clear'
collect2: ld returned 1 exit status
make[1]: *** [httpd] 错误 1
make[1]: Leaving directory `/home/archerwu/code/httpd-2.2.22'
make: *** [all-recursive] 错误 1
网上搜这个错误http://ggb98.blog.163.com/blog/static/9206852201212404951746/ 说是编译apache之前应该先安装apr和apr-util,然后编译选项加上apr和apr-util的安装路径
于是重新./configure如下
#./configure --prefix=/usr/local/apache --with-included-apr --with-apr=/home/archerwu/code/httpd-2.2.22/srclib/apr --with-apr-util=/home/archerwu/code/httpd-2.2.22/srclib/apr-util --enable-modules=most --enable-mods-shared=max
然后
#make
编译成功!!
然后#make install进行安装
3. 配置apache
配置系统启动时自动启动apache服务
在/etc/rc.local中加入如下一下
/usr/local/apache/apachectl -k start
但是在SUSE系统中,没有rc.local,为此参考网上方法在系统中自己建了一个rc.local
http://wenku.baidu.com/view/c0f66574a417866fb84a8ed9.html
Apache的配置文件httpd.conf的配置可以参考
http://wenku.baidu.com/view/6781e29951e79b89680226f2.html
还有其他具体的配置方法不细讲了,网上说明挺多的。